From 5e73f03f0121743c24f3fc31d801a6ccc29ed7f7 Mon Sep 17 00:00:00 2001 From: ThanKarab Date: Tue, 1 Dec 2026 14:10:07 +0200 Subject: [PATCH] feat: prepare the MIP 9.3.0 release candidate Pin platform-ui 3.1.0, platform-backend 11.0.1, Exaflow 1.4.0, and mip-jupyter 0.3.0 for Compose and Kubernetes. Use RabbitMQ for analysis execution, simplify Exaflow worker deployment, and update the runtime configuration for the frontend image. Document the upgrade and the release features, including the Python client, PCA and K-means preprocessing, analysis errors, and the notebook operator. --- README.md | 87 +++++++----------- deployment/dev/.env.example | 10 +-- deployment/dev/README.md | 2 +- .../dev/config/localworkers_config.json | 1 - deployment/dev/config/workers_config.json | 1 + deployment/dev/docker-compose.yml | 59 ++---------- deployment/docs/BackupAndRecovery.md | 29 +++--- deployment/kubernetes/README.md | 90 ++++++++++++------- .../kubernetes/templates/platform-ui.yaml | 5 ++ deployment/kubernetes/values.yaml | 16 ++-- documentation/Architecture.md | 58 ++++++------ documentation/Components.md | 31 ++++--- .../MIP_Data_management_documentation.md | 10 +-- documentation/algorithms.md | 81 +++++++++-------- documentation/notebook-operator.md | 8 +- documentation/notebooks.md | 58 +++++++++--- 16 files changed, 279 insertions(+), 267 deletions(-) delete mode 100644 deployment/dev/config/localworkers_config.json create mode 100644 deployment/dev/config/workers_config.json diff --git a/README.md b/README.md index af33d58a..161bf485 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ More information is available on the [MIP Website](https://ebrains.eu/data-tools # Table of Contents - [About MIP](#about-mip) -- [9.2 Release](#mip-92-release--major-updates) +- [MIP 9.3.0 release](#mip-930-release) - [What MIP Includes](#what-mip-includes) - [Deployment](#deployment) - [Federated Analysis Algorithms](#federated-analysis-algorithms) @@ -27,58 +27,31 @@ federated statistical and machine-learning analyses across participating sites. This repository collects the technical, deployment, data-management, and architecture documentation needed to understand, deploy, and operate MIP. -# MIP 9.2 Release – Major Updates - -## Advanced data handling in the UI - -The redesigned Data Handling step makes advanced preparation part of the -Experiment Studio workflow. Researchers can configure cohort filters, -missing-value handling, outlier treatment, and transformations, then review -summaries and charts of the prepared data before choosing an analysis. - -## More transformation options - -Researchers can create new categorical columns from filter-based rules, defining -categories from conditions on existing variables. K-means is also available as -a preprocessing option: a fitted clustering result can be reused to create a -categorical cluster column for downstream analyses. These options extend the -existing missing-value, outlier, and longitudinal transformations. - -## Revamped visualizations and simpler execution - -The Experiment Studio guides researchers through data exploration, preparation, -algorithm configuration, execution, and results. Algorithm visualizations and -result tables have been redesigned, with PDF reports and CSV exports. The -updated dashboard supports experiment folders, search, and side-by-side result -comparison. - -## Jupyter notebooks for federated research - -**Jupyter notebooks are a major new feature in MIP.** Researchers can open a -JupyterLab workspace from the portal and build reproducible analyses in Python. -The pre-installed `mip` client provides data discovery, filters, preprocessing, -and algorithm execution through the platform backend. A welcome notebook, -example analyses, and client documentation help researchers get started while -patient-level records remain at the contributing sites. - -The new [mip-jupyter repository](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.2.1) -provides the notebook workspace, Python client, and Jupyter images. Example notebooks -live in the [mip-examples repository](https://github.com/Medical-Informatics-Platform/mip-examples). - -## Support agent for notebook creation and explanation - -The notebook workspace includes **Cohort Scout**, a support agent that helps -researchers create and edit notebooks, explain analysis code and results, and -navigate the MIP Python client. It is available through Jupyter AI when the -assistant service is configured for the deployment. - -## Expanded analytics and supporting services - -Exaflow adds histogram-based quartile estimates, a binned Mann-Whitney U test, -Standardized Mean Difference, and richer K-means reporting and preprocessing. -The backend introduces analysis and specification endpoints and experiment -folder management to support the revised workflow. The component releases are -listed in [MIP building blocks](documentation/Components.md). +# MIP 9.3.0 Release + +- **Programmatic and AI-assisted access.** Install `mip-client` to discover + data and run federated analyses from Python on your own computer or server. + The `mip` command adds sign-in and catalog discovery, and `mip agent init` + sets up a workspace for an AI assistant. [MIP Python client guide](documentation/notebooks.md#use-mip-from-your-own-computer) +- **Analysis Studio and Analyses Dashboard.** Explore variables and review + prepared data in the studio, inspect updated charts and tables, and organize + saved analyses into studies and analysis groups. API integrations use the + `/services/analyses` and `/services/studies` endpoints. [Component versions and API links](documentation/Components.md) +- **PCA and K-means preprocessing.** The new PCA Column Creator makes + principal component scores available as numerical inputs to downstream + analyses. The K-means Column Creator can now fit a model directly or reuse + an existing fit to assign cluster labels. [Federated algorithms and preprocessing](documentation/algorithms.md#preprocessing) +- **Clearer analysis errors.** Analysis messages distinguish invalid input + and insufficient data from execution failures. Service errors distinguish + an unavailable submission path from a run that exceeds the reply timeout. + [Analysis error handling](documentation/Architecture.md#analysis-errors) +- **RabbitMQ and simpler Exaflow deployment.** The backend submits analyses + and receives results through RabbitMQ. Exaflow's controller coordinates a + single type of worker, removing the dedicated global worker and its resource + requirements. [Kubernetes upgrade guide](deployment/kubernetes/README.md#upgrading-from-92x) +- **Notebook operator.** Kubernetes deployments can delegate notebook pod and + volume creation to the MIP notebook operator. Its optional HTTPS spawn API + lets JupyterHub do this without Kubernetes API access. [Notebook operator guide](documentation/notebook-operator.md) # What MIP Includes @@ -100,7 +73,7 @@ The algorithm documentation describes the available federated analyses and links to the underlying Exaflow analytic engine documentation. - [Available federated analysis algorithms](documentation/algorithms.md) -- [Exaflow Analytic Engine](https://github.com/madgik/exaflow/tree/1.2.1) +- [Exaflow Analytic Engine](https://github.com/madgik/exaflow/tree/1.4.0) # Jupyter Notebooks and Support Agent @@ -109,14 +82,14 @@ pipelines, run federated algorithms, and document results alongside Python code. Cohort Scout can assist with notebook creation and explanation. - [Notebook getting-started guide](documentation/notebooks.md) -- [MIP Jupyter workspace and Python client](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.2.1) +- [MIP Jupyter workspace and Python client](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.3.0) - [MIP example notebooks](https://github.com/Medical-Informatics-Platform/mip-examples) # Data Management Data providers prepare and validate source datasets and metadata before upload. -Researchers configure filters and transformations per analysis in the Experiment -Studio or notebook pipelines; these operations do not rewrite uploaded files. +Researchers configure filters and transformations per analysis in the Analysis +Studio or notebook pipelines. - [Dataset onboarding: Data Management Guide](documentation/MIP_Data_management_documentation.md) diff --git a/deployment/dev/.env.example b/deployment/dev/.env.example index 49d6738a..c6e95070 100644 --- a/deployment/dev/.env.example +++ b/deployment/dev/.env.example @@ -1,9 +1,9 @@ # Versions -EXAFLOW=1.2.1 -PLATFORM_BACKEND=10.2.0 -PLATFORM_UI=2.1.1 -MIP_JUPYTER=0.2.1 -MIP=9.2.1 +EXAFLOW=1.4.0 +PLATFORM_BACKEND=11.0.1 +PLATFORM_UI=3.1.0 +MIP_JUPYTER=0.3.0 +MIP=9.3.0 # Toggle authentication AUTHENTICATION=0 diff --git a/deployment/dev/README.md b/deployment/dev/README.md index d8cdab51..e914dd44 100644 --- a/deployment/dev/README.md +++ b/deployment/dev/README.md @@ -67,7 +67,7 @@ For source CSVs, data-model metadata, and dataset validation, follow the [Data Management Guide](../../documentation/MIP_Data_management_documentation.md). -Configure per-analysis filters and transformations in the Experiment Studio or +Configure per-analysis filters and transformations in the Analysis Studio or notebook pipelines. The development setup exposes JupyterLab directly; portal-integrated JupyterHub and authenticated notebook spawning are covered by the diff --git a/deployment/dev/config/localworkers_config.json b/deployment/dev/config/localworkers_config.json deleted file mode 100644 index 3e21ed43..00000000 --- a/deployment/dev/config/localworkers_config.json +++ /dev/null @@ -1 +0,0 @@ -["172.28.0.11:5670","172.28.0.12:5671"] diff --git a/deployment/dev/config/workers_config.json b/deployment/dev/config/workers_config.json new file mode 100644 index 00000000..204877bd --- /dev/null +++ b/deployment/dev/config/workers_config.json @@ -0,0 +1 @@ +["172.28.0.12:5671"] diff --git a/deployment/dev/docker-compose.yml b/deployment/dev/docker-compose.yml index b54f92f1..e9ee94bc 100644 --- a/deployment/dev/docker-compose.yml +++ b/deployment/dev/docker-compose.yml @@ -40,24 +40,14 @@ services: DEPLOYMENT_TYPE: LOCAL WORKER_LANDSCAPE_AGGREGATOR_UPDATE_INTERVAL: 30 WORKER_TASKS_TIMEOUT: 30 - FLOWER_ENABLED: false - FLOWER_EXECUTION_TIMEOUT: 30 - FLOWER_SERVER_PORT: 8080 - LOCALWORKERS_CONFIG_FILE: /opt/config/localworkers_config.json - LOCALWORKERS_DNS: "" - LOCALWORKERS_PORT: "" + MAX_CONCURRENT_EXPERIMENTS: 32 + WORKERS_CONFIG_FILE: /opt/config/workers_config.json + WORKERS_DNS: "" + WORKERS_PORT: "" AGGREGATION_SERVER_ENABLED: true AGGREGATION_SERVER_DNS: 172.28.0.13:50051 RABBITMQ_ENABLED: "true" RABBITMQ_URL: amqp://mip:mip@rabbitmq:5672/%2F - SMPC_ENABLED: false - SMPC_OPTIONAL: false - SMPC_COORDINATOR_ADDRESS: "" - SMPC_GET_RESULT_INTERVAL: 10 - SMPC_GET_RESULT_MAX_RETRIES: 100 - DP_ENABLED: false - DP_SENSITIVITY: "" - DP_PRIVACY_BUDGET: "" depends_on: exaflow_aggregation_server: condition: service_started @@ -70,42 +60,10 @@ services: default: ipv4_address: 172.28.0.10 - exaflow_global_worker: - image: madgik/exaflow_worker:${EXAFLOW} - environment: - WORKER_IDENTIFIER: globalworker - WORKER_ROLE: GLOBALWORKER - FEDERATION: dementia - LOG_LEVEL: INFO - FRAMEWORK_LOG_LEVEL: INFO - DUCKDB_PATH: /tmp/globalworker.duckdb - DATA_PATH: /opt/data - CONTROLLER_IP: 172.28.0.10 - CONTROLLER_PORT: 5000 - WORKER_TASKS_TIMEOUT: 30 - PROTECT_LOCAL_DATA: false - GRPC_IP: 172.28.0.11 - GRPC_PORT: 5670 - AGGREGATION_SERVER_ENABLED: true - AGGREGATION_SERVER_DNS: 172.28.0.13:50051 - SMPC_ENABLED: false - SMPC_OPTIONAL: false - SMPC_CLIENT_ID: "" - SMPC_CLIENT_ADDRESS: "" - SMPC_COORDINATOR_ADDRESS: "" - depends_on: - - exaflow_controller - - exaflow_aggregation_server - restart: unless-stopped - networks: - default: - ipv4_address: 172.28.0.11 - exaflow_local_worker1: image: madgik/exaflow_worker:${EXAFLOW} environment: WORKER_IDENTIFIER: localworker1 - WORKER_ROLE: LOCALWORKER FEDERATION: dementia LOG_LEVEL: INFO FRAMEWORK_LOG_LEVEL: INFO @@ -117,13 +75,9 @@ services: PROTECT_LOCAL_DATA: false GRPC_IP: 172.28.0.12 GRPC_PORT: 5671 + GRPC_MAX_WORKERS: 36 AGGREGATION_SERVER_ENABLED: true AGGREGATION_SERVER_DNS: 172.28.0.13:50051 - SMPC_ENABLED: false - SMPC_OPTIONAL: false - SMPC_CLIENT_ID: "" - SMPC_CLIENT_ADDRESS: "" - SMPC_COORDINATOR_ADDRESS: "" depends_on: - exaflow_controller - exaflow_aggregation_server @@ -206,6 +160,9 @@ services: PLATFORM_BACKEND_SERVER: platform-backend:8080 PLATFORM_BACKEND_CONTEXT: services NOTEBOOK_ENABLED: 0 + # nginx resolves this at start; the dev stack has no JupyterHub. + JUPYTER_SERVER: 127.0.0.1:80 + JUPYTER_CONTEXT: notebook MIP_VERSION: "${MIP}" KEYCLOAK_ORIGIN: "${KEYCLOAK_ORIGIN:-}" depends_on: diff --git a/deployment/docs/BackupAndRecovery.md b/deployment/docs/BackupAndRecovery.md index d162d305..620d726a 100644 --- a/deployment/docs/BackupAndRecovery.md +++ b/deployment/docs/BackupAndRecovery.md @@ -1,6 +1,6 @@ # Backup and Recovery -This guide covers the MIP 9.2.1 Kubernetes web and notebook stack and the +This guide covers the MIP 9.3.0 Kubernetes web and notebook stack and the Exaflow data held by participating sites. Persistent data can reside on several nodes or in managed storage. Back up the actual PVCs and site data, together with the configuration needed to recover them. @@ -15,21 +15,24 @@ custom deployments for additional volumes and external services. | Platform PostgreSQL database `portal` | `platform-backend-db-claim0`, mounted at `/var/lib/postgresql` in the `platform-backend-db` container | Database dump plus roles; alternatively, a tested PostgreSQL physical backup procedure. | | Backend application files | `platform-backend-claim0`, mounted at `/opt/platform/api` | Storage snapshot or offline archive. | | Backend logs | `platform-backend-logs-claim0`, mounted at `/var/log/platform-backend` | Retain according to the installation's audit policy. | +| RabbitMQ queues and broker state | `data-exaflow-rabbitmq-0`, mounted at `/var/lib/rabbitmq` in the `exaflow-rabbitmq` StatefulSet | Storage snapshot with the broker stopped. Record the broker identity, configuration, and image version needed to restore the volume. | | JupyterHub database and local state | `jupyterhub-claim0`, mounted at `/srv/jupyterhub` | Snapshot or archive with the Hub stopped, including its database and cookie secret files. | | Users' notebooks and files | Separate user home PVCs mounted at `/home/jovyan`; workspaces are under `/home/jovyan/work` | Snapshot or archive each home after stopping its notebook server. | | Exaflow input data | Each site's CSV/data-model folders on hostPath storage or CSV PVCs | Site-local backups of CSVs, `CDEsMetadata.json`, and other required dataset assets. | | Configuration and credentials | Helm overrides, image versions, ConfigMaps, Kubernetes Secrets, and externally managed settings | Protected configuration backup and secret-manager recovery procedure. | -Include `mip-secret`, `keycloak-credentials`, `jupyterhub-crypt`, and TLS -credentials, plus any registry or operator-specific secrets used by the -installation. The Hub crypt key must match the backed-up Hub auth state. +Include `mip-secret`, `exaflow-rabbitmq`, `keycloak-credentials`, +`jupyterhub-crypt`, and TLS credentials, plus any registry or operator-specific +secrets used by the installation. The Hub crypt key must match the backed-up +Hub auth state. Coordinate recovery of the external Keycloak realm and clients with its owner. For operator-based notebook spawning, retain the operator/CRD versions and NotebookProfile configuration as well. -Exaflow's current workers build DuckDB files on `emptyDir` volumes. These files -are rebuilt from source datasets, rather than treated as durable backups. -In-flight analyses and aggregation contexts are transient and must be rerun. +Exaflow's workers rebuild their DuckDB files on `emptyDir` volumes from source +datasets. In-flight execution and aggregation state are transient. Restored +RabbitMQ messages can be redelivered, so reconcile queued and completed analyses +before resubmitting work. ## Prepare a consistent backup @@ -38,17 +41,17 @@ In-flight analyses and aggregation contexts are transient and must be rerun. versions. Choose the retention period and acceptable data-loss window for the installation. 2. Schedule a maintenance window. Pause ingress or otherwise block new web and - notebook requests, allow active analyses to finish, and stop all user - notebook servers. Suspend GitOps/operator reconciliation where needed so + notebook requests, let queued and active analyses finish, and stop all + user notebook servers. Suspend GitOps/operator reconciliation where needed so stopped services are not recreated during the backup. 3. Stop the JupyterHub workload before copying its state. Quiesce backend application writes while keeping PostgreSQL running for a logical dump. The backend and PostgreSQL share one Deployment/pod in this chart: scaling `platform-backend` to zero stops both, so take the dump before scaling it down. Include other API clients when blocking writes. -4. Back up PostgreSQL, then snapshot/archive backend files, Hub state, and every - notebook home while their writers are stopped. Coordinate site dataset - backups with data managers and pause any dataset updates during capture. +4. Back up PostgreSQL, then snapshot/archive backend files, the RabbitMQ PVC, + Hub state, and every notebook home while their writers are stopped. Coordinate + site dataset backups with data managers and pause dataset updates during capture. 5. Store configuration, secret recovery material, and the inventory with the backup set. Encrypt backups, restrict access, and keep a copy independent of the live storage. Clinical datasets stay within each site's governance @@ -120,7 +123,7 @@ capture notebook files or Kubernetes configuration. data models and datasets are available. 7. Stop the temporary PostgreSQL recovery workload before starting the regular stack with its restored PVC. Start the backend and Hub with external access - still restricted. Confirm login, saved experiments and folders, and access + still restricted. Confirm login, saved analyses and studies, and access permissions. Open a user's notebook and check saved files and `mip.Client.from_env()`. Run a representative analysis from the portal and a notebook. diff --git a/deployment/kubernetes/README.md b/deployment/kubernetes/README.md index d1cdefe8..f5024fd2 100644 --- a/deployment/kubernetes/README.md +++ b/deployment/kubernetes/README.md @@ -28,24 +28,23 @@ Now, with the Kubernetes (K8s) deployment, we have 2 main component packs, that ### The analysis engine: Exaflow -Deploy the [Exaflow 1.2.1 chart](https://github.com/madgik/exaflow/tree/1.2.1/kubernetes) +Deploy the [Exaflow 1.4.0 chart](https://github.com/madgik/exaflow/tree/1.4.0/kubernetes) for the native federated pipeline: -- Controller: accepts analyses and coordinates execution. -- Local workers: load each site's datasets and execute local computations. -- Global worker: provides the chart's global-worker service. +- The controller consumes analysis requests from RabbitMQ and coordinates execution. +- Workers load each site's datasets and execute local computations. Exaflow uses a + single worker role and removes the dedicated global worker. - Aggregation server: combines partial vectors for algorithms and preprocessing steps that require aggregation. Keep `aggregation_server.enabled: true` for the full native algorithm portfolio. -Flower and SMPC are optional features with separate setup requirements. The -example below disables them and focuses on the native pipeline. - ### The web and notebook stack -- **platform-ui**: Experiment Studio, result visualizations, and notebook entry. -- **platform-backend**: authenticated analysis API and experiment management. -- **PostgreSQL**: stores platform experiments, folders, and other application state. +- **platform-ui**: Analysis Studio, Analyses Dashboard, and notebook entry. +- **platform-backend**: authenticated analysis API and study management. +- **RabbitMQ** carries analysis requests and replies between platform-backend + and Exaflow. [Broker setup](#analyses-through-rabbitmq) +- **PostgreSQL**: stores platform analyses, studies, and other application state. - **JupyterHub and single-user JupyterLab**: notebook sessions and workspaces, using images from **mip-jupyter**. Hub state and user homes use separate PVCs. - **External Keycloak**: provides authentication; this chart wires an existing @@ -64,15 +63,13 @@ For unmanaged Exaflow clusters, the chart mounts `/csvs` from each worker node into `/opt/csvs`. Each data-model directory belongs under that `csvs` directory. With the example below, this is `/data//localworker/csvs`. -Prepare the global worker's `csvs` directory on the master node as well. For managed Exaflow clusters, populate the CSV PVCs provisioned by the Exaflow chart. Data placement and backups remain the responsibility of each data site. The worker DuckDB database is rebuilt from these inputs on startup. -Researcher filters and transformations are configured per analysis in the -Experiment Studio or notebook pipelines. They do not replace dataset onboarding -or alter the source CSV files. +Researchers configure filters and transformations per analysis in the Analysis +Studio or notebook pipelines. Site operators maintain the source CSV files. ## Configuration Prior to deploying it (on a microk8s K8s cluster of one or more nodes), there are a few adjustments to make in `values.yaml`. Each top-level section controls a part of the stack: @@ -124,7 +121,7 @@ Register a Keycloak redirect URI for the Hub OAuth client: For Kubernetes, make sure the images set in `jupyterhub.image` and `jupyterhub.singleuser.image` are pushed to the configured registry or loaded onto every node that may run the pods. -`jupyterhub.spawner: operator-api` removes the hub's Kubernetes access entirely. The hub creates and deletes notebooks through the notebook operator's HTTPS spawn API (`jupyterhub.operatorApi.url`, which must start with `https://`) instead of the Kubernetes API, and the chart renders no Role or RoleBinding, whatever `jupyterhub.rbac.create` says — with `jupyterhub.rbac.create: false`, remove the hand-applied Role and RoleBinding after switching. Both the `jupyterhub` ServiceAccount and the hub pod set `automountServiceAccountToken: false`, so the hub pod gets no ServiceAccount token at the standard path; it authenticates with a projected token bound to the audience `mip-notebook-operator`, which the kubelet rotates and the API server rejects, and trusts the spawn API's CA from the `mip-notebooks-ca` ConfigMap (`jupyterhub.operatorApi.caConfigMap`), which mip-infra copies into each federation. The hub picks up a rotated token or CA without a restart. This mode needs `hbpmip/mip-jupyterhub` > `0.2.1` (`0.3.0+` once released; `0.2.1` does not know `operator-api` and falls back to KubeSpawner without credentials) and the spawn API deployed by mip-infra. +`jupyterhub.spawner: operator-api` removes the hub's Kubernetes access entirely. The hub creates and deletes notebooks through the notebook operator's HTTPS spawn API (`jupyterhub.operatorApi.url`, which must start with `https://`) instead of the Kubernetes API, and the chart renders no Role or RoleBinding, whatever `jupyterhub.rbac.create` says — with `jupyterhub.rbac.create: false`, remove the hand-applied Role and RoleBinding after switching. Both the `jupyterhub` ServiceAccount and the hub pod set `automountServiceAccountToken: false`, so the hub pod gets no ServiceAccount token at the standard path; it authenticates with a projected token bound to the audience `mip-notebook-operator`, which the kubelet rotates and the API server rejects, and trusts the spawn API's CA from the `mip-notebooks-ca` ConfigMap (`jupyterhub.operatorApi.caConfigMap`), which mip-infra copies into each federation. The hub picks up a rotated token or CA without a restart. This mode needs `hbpmip/mip-jupyterhub` `0.3.0` or later (older images do not know `operator-api` and fall back to KubeSpawner without credentials) and the spawn API deployed by mip-infra. The reachability diagram from the legacy profiles is still valid as a reference for deciding the correct public URL: ![MIP Reachability Scheme](../docs/MIP_Configuration.png) @@ -139,7 +136,8 @@ If you deploy behind a reverse proxy or load balancer, forward the standard `X-F **WARNING!**: In **ANY** case, when you use an **EXTERNAL** KeyCloak service (i.e. iam.ebrains.eu), make sure that you use the correct *CLIENT_ID* and *CLIENT_SECRET* to match the MIP instance you're deploying! -After tailoring `values.yaml` you can deploy the UI Helm chart. We still recommend deploying the engine Helm charts first, before installing the UI components. +Follow the [RabbitMQ setup](#analyses-through-rabbitmq) when deploying the two +charts. The MIP chart provisions the broker that the Exaflow controller uses. ### Using MIP from users' own computers @@ -163,7 +161,7 @@ Before turning the feature on (setting `keycloak.cliClientId`), check off: - [ ] The Keycloak client settings above are verified: the sign-in settings, the federation-limited scope, and the re-authentication override and consent (ask EBRAINS). - [ ] `keycloak.requiredAudience` is set on the backend (step 5 under *Security settings for each federation*). -- [ ] A platform-ui image with `prompt=login` on the account page is deployed (name the minimum version here once released). +- [ ] platform-ui 3.1.0 is deployed and creating a token on the account page prompts the user to sign in again. - [ ] The revocation runbook above (*Ending a local-client sign-in*) is in place. @@ -184,8 +182,28 @@ Do these in order; each step needs the one before it. Upgrade notes: -- Users without a role on the platform client can no longer open notebooks, and users without a shared experiment's datasets can no longer read it. -- The chart does not change image tags. `KEYCLOAK_REQUIRED_AUDIENCE` and `KEYCLOAK_ORIGIN` do nothing until you deploy images that read them. +- Notebook access requires a role on the platform client. Access to a shared analysis requires access to its datasets. + +### Upgrading from 9.2.x + +1. Back up the platform database before upgrading. platform-backend 11.0.1 + applies Flyway migrations V5 and V6 on startup when they are pending. V6 + renames tables and columns. [Backup and Recovery](../docs/BackupAndRecovery.md) +2. Update the Exaflow values. Rename `localnodes` to `worker_count`, remove + global-worker, Flower, and SMPC settings, and keep the aggregation server + enabled for the full native algorithm portfolio. +3. If you set `EXPERIMENT_RUN_DRAFT_TTL`, rename it to `ANALYSIS_RUN_DRAFT_TTL`. + Give every notebook user a role on the platform's Keycloak client to avoid + HTTP `403` when opening a notebook. +4. Create the shared `exaflow-rabbitmq` Secret and deploy the charts in the same + maintenance window. Use Exaflow 1.4.0, platform-backend 11.0.1, platform-ui + 3.1.0, and mip-jupyter 0.3.0 together. Bring up the broker before validating + Exaflow and check that `GET /healthcheck/rabbitmq` returns `consuming: true`. + [Broker setup](#analyses-through-rabbitmq) +5. Migrate external clients from `/services/experiments` to the new + `/services/analyses` and `/services/studies` contracts. Verify data discovery, + an analysis run, and notebook access before reopening the deployment. + [Backend API contracts](https://github.com/Medical-Informatics-Platform/platform-backend/blob/11.0.1/docs/context/module-index.md) ### Microk8s installation On a running Ubuntu (we recommend 22.04) distribution, install microk8s (we **HIGHLY** recommend to **NOT** install Docker on your Kubernetes cluster!): @@ -224,7 +242,7 @@ For a "federated" deployment, you may want to add nodes to your cluster. "microk Clone the matching engine release and create an environment-specific values file: ```bash -sudo git clone --branch 1.2.1 https://github.com/madgik/exaflow /opt/exaflow +sudo git clone --branch 1.4.0 https://github.com/madgik/exaflow /opt/exaflow sudo chown -R mipadmin:mipadmin /opt/exaflow cp /opt/exaflow/kubernetes/values.yaml /opt/exaflow/kubernetes/my-values.yaml ``` @@ -235,25 +253,22 @@ namespace, federation name, paths, and worker count for your installation: ```yaml namespace: managed_cluster: false -localnodes: 1 +worker_count: 1 exaflow_images: repository: madgik - version: 1.2.1 + version: 1.4.0 federation: aggregation_server: enabled: true -flower: - enabled: false -smpc: - enabled: false +rabbitmq: + existing_secret: exaflow-rabbitmq storage: hostPath: db: localworker: /data//localworker - globalworker: /data//globalworker ``` -`localnodes` counts local workers. The chart requires one local worker per +`worker_count` counts workers. The chart requires one worker per eligible host through pod anti-affinity; a single-host installation uses `1` and labels the same node as both master and worker. The current templates use `managed_cluster` to select hostPath versus CSV PVC storage; `storage.type` @@ -281,7 +296,7 @@ backend's `engines.exaflow.url` must reach `exaflow-controller-service`; the existing short service name works when both charts share a namespace. For separate namespaces use the controller's fully qualified service DNS name. -See the [Exaflow chart](https://github.com/madgik/exaflow/tree/1.2.1/kubernetes) +See the [Exaflow chart](https://github.com/madgik/exaflow/tree/1.4.0/kubernetes) for the full values and templates. The old `credentials_location`, `db.storage_location`, `db.csvs_location`, and `controller.cleanup_file_folder` settings are not used by this chart. @@ -290,7 +305,7 @@ settings are not used by this chart. MIP submits analyses to Exaflow over RabbitMQ (specifications and metadata still use `engines.exaflow.url`). The chart always deploys the in-namespace RabbitMQ 4.4.1 broker. -1. Use an Exaflow build that includes [madgik/exaflow#673](https://github.com/madgik/exaflow/pull/673) and [madgik/exaflow#681](https://github.com/madgik/exaflow/pull/681). Upgrade the controller, workers, and aggregation server together. Use a platform-backend build that includes the RabbitMQ transport. Run one Exaflow controller replica and one backend replica. +1. Use Exaflow 1.4.0 or later and platform-backend 11.0.1 or later. Upgrade the controller, workers, and aggregation server together. Run one Exaflow controller replica and one backend replica. 2. Create the `exaflow-rabbitmq` Secret before deploying. Use a URL-safe password (`openssl rand -hex 24`): the same password is embedded in `url`, which Exaflow and the backend read, while the broker reads `username` and `password`. Keep `%2F` as the trailing vhost path so both the Java and Python AMQP clients select the default `/` vhost. The host is the in-namespace Service: ```bash @@ -302,12 +317,25 @@ kubectl create secret generic exaflow-rabbitmq -n \ ``` 3. Deploy this chart so the RabbitMQ broker starts. +<<<<<<< HEAD 4. The Exaflow chart always enables RabbitMQ; there is no flag. The chart defaults `existing_secret: exaflow-rabbitmq` and `url_secret_key: url` already match this Secret. Deploy Exaflow. `GET /healthcheck/rabbitmq` on the controller must return 200 with `consuming: true`. +======= +4. The Exaflow chart requires the broker Secret. Its defaults `existing_secret: exaflow-rabbitmq` and `url_secret_key: url` already match this Secret. Deploy Exaflow. `GET /healthcheck/rabbitmq` on the controller must return 200 with `consuming: true`. +>>>>>>> 453742d (feat: prepare the MIP 9.3.0 release candidate) 5. Delivery is at least once, so an analysis can run twice after a controller crash. Broker persistence and backups are your responsibility. The StatefulSet retains its PVC when the broker is deleted or scaled down; keep that PVC until dead-letter messages are inspected. 6. `RABBITMQ_DEFAULT_USER` and `RABBITMQ_DEFAULT_PASS` apply only on first boot with an empty volume. Rotate by running `kubectl exec -n exaflow-rabbitmq-0 -- rabbitmqctl change_password ` first, then update the Secret (`password` and `url`), then restart the Exaflow controller and platform-backend. 7. This chart's broker is RabbitMQ 4.4.1 and writes `consumer_timeout = 7200000`, `max_message_size = 33554432`, `vm_memory_high_watermark.relative = 0.6`, and `raft.wal_max_size_bytes = 134217728` into `rabbitmq.conf` with a 2Gi memory limit. Keep those settings if tuning overrides: RabbitMQ's 30 minute consumer timeout and 16 MiB message limit make long analyses redeliver and oversized requests fail at the broker instead of returning Exaflow's `request_too_large`, and less memory risks tripping the memory alarm or OOMKills under the quorum Raft WAL, 32 MiB messages, and 256 MiB queues. 8. Optional hardening: the Secret's user is the broker administrator and is shared by Exaflow and the backend. For stricter isolation, create a backend user, put its URL in its own Secret, and point platform-backend at that Secret with `engines.exaflow.rabbitmq.existingSecret` and `engines.exaflow.rabbitmq.urlSecretKey`. Leave `existingSecret` empty to keep using `rabbitmq.existingSecret` and the `url` key. On RabbitMQ 4.3.1 and later, including 4.4.1, `queue.declare(passive=true)` needs at least one permission (`read`, `write`, or `configure`) on `exaflow.analysis.requests`. Grant the backend user `configure` `^platform-backend\.analysis\.replies$`, `write` `^(amq\.default|platform-backend\.analysis\.replies)$`, and `read` `^(platform-backend\.analysis\.replies|exaflow\.analysis\.requests)$`. +For troubleshooting, distinguish the two transport errors returned by the backend. + +| HTTP status | What happened | +| --- | --- | +| `503 Service Unavailable` | Submission failed before the broker confirmed it. Preview requests (`POST /services/analyses/preview`) also return `503` immediately when the request queue has no consumer. Regular analysis runs (`POST /services/analyses/runs`) can queue while the controller restarts if the request queue already exists. | +| `504 Gateway Timeout` | The broker confirmed submission and no reply arrived within `EXAFLOW_RABBITMQ_REPLY_TIMEOUT` (one hour by default). Exaflow may still finish the run. | + +See the [backend transport settings and error behavior](https://github.com/Medical-Informatics-Platform/platform-backend/blob/11.0.1/README.md#external-services). + ### Web and notebook stack deployment The deployment chart lives in this **mip** repository: @@ -318,7 +346,7 @@ sudo chown -R mipadmin:mipadmin /opt/mip cp /opt/mip/deployment/kubernetes/values.yaml /opt/mip/deployment/kubernetes/my-values.yaml ``` -Use the MIP 9.2.1 release checkout when available. Edit `my-values.yaml` for your +Use the MIP 9.3.0 release checkout when available. Edit `my-values.yaml` for your installation, including image versions, ingress settings, storage classes, and external authentication. On microk8s set `cluster.managed: false`; on managed clusters set it to `true` and choose the appropriate managed storage class. diff --git a/deployment/kubernetes/templates/platform-ui.yaml b/deployment/kubernetes/templates/platform-ui.yaml index dae60b97..b99c9089 100644 --- a/deployment/kubernetes/templates/platform-ui.yaml +++ b/deployment/kubernetes/templates/platform-ui.yaml @@ -29,6 +29,11 @@ spec: labels: app: platform-ui spec: + # nginx runs as UID 101 and listens on port 80. + securityContext: + sysctls: + - name: net.ipv4.ip_unprivileged_port_start + value: "0" {{- if eq (toString .Values.cluster.managed) "false" }} nodeSelector: master: "true" diff --git a/deployment/kubernetes/values.yaml b/deployment/kubernetes/values.yaml index 33280fc0..ccf528da 100644 --- a/deployment/kubernetes/values.yaml +++ b/deployment/kubernetes/values.yaml @@ -19,11 +19,11 @@ engines: replyTimeout: "" publishTimeout: "" mip: - version: 9.2.1 + version: 9.3.0 platform-ui: image: repository: hbpmip/platform-ui - tag: 2.1.1 + tag: 3.1.0 ingress: enabled: true className: haproxy-public @@ -41,7 +41,7 @@ platform-ui: platform-backend: image: repository: hbpmip/platform-backend - tag: 10.2.0 + tag: 11.0.1 config: logLevel: INFO logLevelFramework: INFO @@ -81,7 +81,7 @@ jupyterhub: cryptKey: "" image: repository: hbpmip/mip-jupyterhub - tag: 0.2.1 + tag: 0.3.0 resources: requests: cpu: 100m @@ -104,9 +104,9 @@ jupyterhub: # operator-api: no Role or RoleBinding is rendered (remove any # hand-applied Role/RoleBinding after switching). create: true - # operator-api only. Needs hbpmip/mip-jupyterhub > 0.2.1 (0.3.0+ once - # released; 0.2.1 falls back to KubeSpawner without credentials) and the - # spawn API deployed (mip-infra). The hub authenticates with a ServiceAccount + # operator-api only. Needs hbpmip/mip-jupyterhub 0.3.0 or later (older + # images fall back to KubeSpawner without credentials) and the spawn API + # deployed (mip-infra). The hub authenticates with a ServiceAccount # token bound to the spawn API's audience: the kubelet rotates it, and the # API server rejects it. caConfigMap holds the spawn API's CA under ca.crt # (mip-infra copies it into each federation). @@ -129,7 +129,7 @@ jupyterhub: singleuser: image: repository: hbpmip/mip-jupyter - tag: 0.2.1 + tag: 0.3.0 storageCapacity: 2Gi resources: requests: diff --git a/documentation/Architecture.md b/documentation/Architecture.md index b98fe17e..2fc14709 100644 --- a/documentation/Architecture.md +++ b/documentation/Architecture.md @@ -18,40 +18,42 @@ The MIP is designed following an N-Tier paradigm. Multiple tiers are identified - **MIP Federated** offers federated analysis over anonymized data, across multiple hospitals -### Analysis workflow and notebook workspace - -The redesigned Experiment Studio brings data exploration, Data Handling, -algorithm configuration, execution, and result review into one guided workflow. -Data Handling includes cohort filters, missing-value and outlier treatment, -filter-based categorical columns, and reusable K-means cluster columns. The -experiments dashboard organizes saved analyses in folders and supports result -comparison and export. - -JupyterLab provides a second entry point for researchers who want to compose -analyses in Python. The new **mip-jupyter** component packages the notebook -workspace, `mip` Python client, and JupyterHub and single-user images. Examples come from the -public `mip-examples` repo, synced by mip-infra onto one read-only volume that the notebook -operator mounts. -The client sends requests through **platform-backend**, which applies platform -access controls and delegates federated computation to **Exaflow**: +### Analysis workflow + +Researchers use the **Analysis Studio** in the portal or `mip-client` from a +Jupyter notebook or Python script. Both entry points call **platform-backend** +over HTTP. The backend applies platform access controls, exchanges analysis +requests and results with the **Exaflow controller** over RabbitMQ, and reads +specifications and metadata from Exaflow over HTTP. ```text -Experiment Studio -> platform-backend -> Exaflow -> participating data sites -Jupyter notebook -> mip Python client -> platform-backend -> Exaflow +Analysis Studio or mip-client <-- HTTP --> platform-backend +platform-backend <-- HTTP specifications and metadata --> Exaflow controller +platform-backend <-- RabbitMQ analysis requests and replies --> Exaflow controller +Exaflow controller <-- gRPC --> workers at participating sites ``` -Both interfaces use the platform's analysis and specification APIs. Row-level -clinical records remain at the data sites; notebooks receive analysis results -through the backend. +Workers share one role and run computations on data at their own sites. The +aggregation server combines partial results for steps that require it. Row-level +clinical records stay at the data sites. [RabbitMQ deployment](../deployment/kubernetes/README.md#analyses-through-rabbitmq) + +### Analysis errors + +Exaflow distinguishes invalid inputs, insufficient usable data, and analyses +that cannot produce a valid result, such as a model that fails to converge. +The backend passes those explanations to clients and uses a generic message +for unexpected internal failures. It also distinguishes an unavailable +submission path from a timeout waiting for the result of a broker-confirmed +submission. [Backend error handling](https://github.com/Medical-Informatics-Platform/platform-backend/blob/11.0.1/README.md#external-services) -When configured, **Cohort Scout** provides notebook creation, editing, and -explanation through Jupyter AI. Notebook access requires JupyterHub and -identity-provider integration; the assistant also requires a configured model -service. The existing diagrams below describe the core analysis architecture; -this section adds the notebook path. +### Notebook workspace -See the [component versions](Components.md) and -[notebook guide](notebooks.md) for repository links and starting instructions. +JupyterHub launches authenticated JupyterLab sessions. In `operator-api` mode, +it calls the notebook operator's HTTPS spawn API. The operator provisions pods +and user volumes from a `NotebookProfile` and can mount shared examples on a +read-only volume. When configured, **Cohort Scout** helps researchers create, +edit, and explain notebooks through Jupyter AI. +[Notebook guide](notebooks.md) · [Notebook operator guide](notebook-operator.md) ### Data Management diff --git a/documentation/Components.md b/documentation/Components.md index 353c038e..f664765e 100644 --- a/documentation/Components.md +++ b/documentation/Components.md @@ -1,14 +1,14 @@ -# Components in MIP 9.2.1 +# Components in MIP 9.3.0 -MIP combines the following independently released repositories. These component -versions make up the MIP 9.2.1 release. +MIP combines the following independently released components. These are the +versions used by the MIP 9.3.0 release. | Repository | Version | Role and major changes | | --- | --- | --- | -| [platform-ui](https://github.com/Medical-Informatics-Platform/platform-ui/tree/2.1.1) | 2.1.1 | Redesigned Experiment Studio and Data Handling, filter-based categorical columns, K-means preprocessing, refreshed visualizations, experiment folders, exports, and notebook entry point. Saving an experiment stores the reviewed run without executing it again. | -| [platform-backend](https://github.com/Medical-Informatics-Platform/platform-backend/tree/10.2.0) | 10.2.0 | Analysis and specification endpoints, experiment folder persistence and management, authenticated access for web and notebook analyses, kept runs that can be saved without re-execution, and one experiment API for preview, run and save. | -| [exaflow](https://github.com/madgik/exaflow/tree/1.2.1) | 1.2.1 | Federated execution and preprocessing, reusable K-means cluster columns, quartiles, binned Mann-Whitney U, Standardized Mean Difference, and updated analysis requests. | -| [mip-jupyter](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.2.1) | 0.2.1 | JupyterLab workspace, `mip` Python client (distributed as `mip-client`), welcome notebook, JupyterHub and single-user images, and Cohort Scout notebook support agent. Example notebooks now come from the shared, read-only [mip-examples](https://github.com/Medical-Informatics-Platform/mip-examples) repository. | +| [platform-ui](https://github.com/Medical-Informatics-Platform/platform-ui/tree/3.1.0) | 3.1.0 | Analysis Studio and Analyses Dashboard, studies and analysis groups, new data exploration and result views, account-page tokens for the `mip` client, and an enforced Content Security Policy. | +| [platform-backend](https://github.com/Medical-Informatics-Platform/platform-backend/tree/11.0.1) | 11.0.1 | Analysis and study APIs, RabbitMQ analysis submission, clearer analysis errors, and stronger sign-in, session, and dataset access checks. | +| [exaflow](https://github.com/madgik/exaflow/tree/1.4.0) | 1.4.0 | RabbitMQ analysis consumer, FastAPI controller, PCA component columns, fit and reuse modes for K-means cluster columns, and one worker role. | +| [mip-jupyter](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.3.0) | 0.3.0 | JupyterHub and JupyterLab images, Cohort Scout, and `mip-client` for Python scripts, notebooks, and AI assistants. The package provides the `mip` Python module and CLI. | ## Deployment and infrastructure @@ -16,16 +16,23 @@ versions make up the MIP 9.2.1 release. in this repository. - [MIP Infrastructure](https://github.com/Medical-Informatics-Platform/mip-infra): MIP KaaS infrastructure based on ArgoCD deployments. -- [Notebook integration notes](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.2.1/docs/operators.md): +- The MIP chart provisions RabbitMQ 4.4.1 for analysis requests and replies. + [RabbitMQ deployment](../deployment/kubernetes/README.md#analyses-through-rabbitmq) +- The optional notebook operator provisions notebook pods and volumes. Its + HTTPS spawn API lets JupyterHub manage notebook sessions without Kubernetes + API access. [Notebook operator](notebook-operator.md) +- [Notebook integration notes](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.3.0/docs/operators.md): JupyterHub, authentication, workspace images, and assistant configuration. -The backend 10.x and Exaflow 1.2.x releases change the analysis request/API -contracts. Integrations must use the revised analysis and specification APIs; -older clients and deployment configurations need review before upgrading. +Deploy the listed versions together. External clients must migrate to +`/services/analyses` and `/services/studies` for analysis and study management. +[Backend API contracts](https://github.com/Medical-Informatics-Platform/platform-backend/blob/11.0.1/docs/context/module-index.md) · +[Upgrading from 9.2.x](../deployment/kubernetes/README.md#upgrading-from-92x) + Notebook access requires JupyterHub deployment and authentication wiring, and Cohort Scout requires its assistant service to be configured. ## Additional standalone tools - [Quality Control Tools](https://github.com/HBPMedical/DataQualityControlTool/tree/v.4.1) -- [DataCatalog](https://github.com/Medical-Informatics-Platform/datacatalog/tree/2.0.0) +- [DataCatalog](https://github.com/Medical-Informatics-Platform/datacatalog/tree/3.0.0) diff --git a/documentation/MIP_Data_management_documentation.md b/documentation/MIP_Data_management_documentation.md index 3fdcd6a9..ec917eb1 100644 --- a/documentation/MIP_Data_management_documentation.md +++ b/documentation/MIP_Data_management_documentation.md @@ -45,11 +45,11 @@ model, preparing and validating source CSVs and `CDEsMetadata.json`, and making them available at the data site. Source corrections and metadata changes belong to this process. -Researchers configure **per-analysis preparation** after selecting available -datasets. Cohort filters, missing-value and outlier handling, longitudinal -transformations, filter-based categorical columns, and K-means cluster columns -belong in the Experiment Studio or notebook pipeline. These operations do not -rewrite uploaded source files. +Researchers configure **per-analysis preparation** in the Analysis Studio or +in a notebook pipeline after selecting datasets. The Analysis Studio can also +create numerical PCA component columns and categorical K-means cluster columns +for downstream analyses. These operations use the uploaded source files as +inputs. [Preprocessing guide](algorithms.md#preprocessing) ## Concepts and Definitions diff --git a/documentation/algorithms.md b/documentation/algorithms.md index 79428afd..1f23053c 100644 --- a/documentation/algorithms.md +++ b/documentation/algorithms.md @@ -1,9 +1,7 @@ # Federated Analysis Algorithms -The MIP federated analysis algorithms are implemented and documented in Exaflow. -The algorithm-specific technical documentation is available in the Exaflow -repository under -[documentation/algorithms](https://github.com/madgik/exaflow/tree/master/documentation/algorithms). +The MIP federated analysis algorithms are implemented in Exaflow. This catalog +links to the version used by MIP 9.3.0. [Exaflow 1.4.0 algorithm documentation](https://github.com/madgik/exaflow/tree/1.4.0/documentation/algorithms) The linked Exaflow documentation describes each algorithm's inputs, parameters, statistical or machine-learning method, federated computation, outputs, @@ -13,58 +11,63 @@ validation reference, and limitations. | Algorithm | Description | Documentation | |---|---|---| -| Descriptive Statistics | Summarizes selected numerical and nominal variables with per-dataset and combined summaries. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/Describe.md) | -| Histogram | Computes counts for one numerical or categorical variable, optionally split by categorical grouping variables. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/Histogram.md) | -| Outlier Report | Reports outlier bounds, counts, and percentages for numerical variables using Gaussian, IQR, MAD, or quantile rules. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/outlier_report.md) | -| Quartiles | Estimates Q1, the median, and Q3 for a numerical variable using iterative federated histogram refinement. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/quartiles.md) | +| Descriptive Statistics | Summarizes selected numerical and nominal variables with per-dataset and combined summaries. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/Describe.md) | +| Histogram | Computes counts for one numerical or categorical variable, optionally split by categorical grouping variables. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/Histogram.md) | +| Outlier Report | Reports outlier bounds, counts, and percentages for numerical variables using Gaussian, IQR, MAD, or quantile rules. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/outlier_report.md) | +| Quartiles | Estimates Q1, the median, and Q3 for a numerical variable using iterative federated histogram refinement. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/quartiles.md) | ## Statistical Tests | Algorithm | Description | Documentation | |---|---|---| -| One-way ANOVA | Tests whether a numerical outcome has the same mean across levels of one categorical grouping variable. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/ANOVAOneWay.md) | -| Two-way ANOVA | Tests whether a numerical outcome differs across two categorical factors, including main effects and interaction. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/ANOVATwoWay.md) | -| Chi-squared Test | Evaluates whether two categorical variables are independent using a contingency table. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/ChiSquared.md) | -| Fisher's Exact Test | Evaluates association between two binary categorical variables using exact 2 by 2 table probabilities. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/FisherExact.md) | -| Independent t-test | Compares the mean of a numerical variable between two independent groups using the pooled-variance Student t-test. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/TtestIndependent.md) | -| One-sample t-test | Compares the mean of a numerical variable with a reference mean. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/TtestOneSample.md) | -| Paired t-test | Compares two related numerical measurements by testing whether the mean paired difference is zero. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/TtestPaired.md) | -| Pearson Correlation | Measures linear association between numerical variables and reports correlations, p-values, and confidence intervals. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/Pearson.md) | -| Binned Mann-Whitney U Test | Compares a numerical variable across two independent groups using approximate ranks from histogram bins. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/binned_mann_whitney_u_test.md) | -| Standardized Mean Difference | Reports pairwise Cohen's d effect sizes across categories of a grouping variable. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/standardized_mean_difference.md) | +| One-way ANOVA | Tests whether a numerical outcome has the same mean across levels of one categorical grouping variable. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/ANOVAOneWay.md) | +| Two-way ANOVA | Tests whether a numerical outcome differs across two categorical factors, including main effects and interaction. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/ANOVATwoWay.md) | +| Chi-squared Test | Evaluates whether two categorical variables are independent using a contingency table. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/ChiSquared.md) | +| Fisher's Exact Test | Evaluates association between two binary categorical variables using exact 2 by 2 table probabilities. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/FisherExact.md) | +| Independent t-test | Compares the mean of a numerical variable between two independent groups using the pooled-variance Student t-test. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/TtestIndependent.md) | +| One-sample t-test | Compares the mean of a numerical variable with a reference mean. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/TtestOneSample.md) | +| Paired t-test | Compares two related numerical measurements by testing whether the mean paired difference is zero. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/TtestPaired.md) | +| Pearson Correlation | Measures linear association between numerical variables and reports correlations, p-values, and confidence intervals. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/Pearson.md) | +| Binned Mann-Whitney U Test | Compares a numerical variable across two independent groups using approximate ranks from histogram bins. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/binned_mann_whitney_u_test.md) | +| Standardized Mean Difference | Reports pairwise Cohen's d effect sizes across categories of a grouping variable. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/standardized_mean_difference.md) | + +MIP 9.3.0 includes corrected t-test confidence intervals for the selected +significance level and the one-sided or two-sided alternative hypothesis. ## Regression and Survival Analysis | Algorithm | Description | Documentation | |---|---|---| -| Linear Regression | Fits an ordinary least squares model for a numerical outcome using numerical and/or categorical covariates. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/LinearRegression.md) | -| Logistic Regression | Models a binary outcome as a function of numerical and/or categorical covariates. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/LogisticRegression.md) | -| Cox Proportional Hazards Regression | Models time-to-event data with a partial likelihood Cox model and an unspecified baseline hazard. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/cox_regression_classical.md) | -| Stacked Cox Regression | Approximates time-to-event modeling by expanding survival data into risk-set rows and fitting logistic regression with time-bin indicators. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/cox_regression_stacked.md) | +| Linear Regression | Fits an ordinary least squares model for a numerical outcome using numerical and/or categorical covariates. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/LinearRegression.md) | +| Logistic Regression | Models a binary outcome as a function of numerical and/or categorical covariates. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/LogisticRegression.md) | +| Cox Proportional Hazards Regression | Models time-to-event data with a partial likelihood Cox model and an unspecified baseline hazard. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/cox_regression_classical.md) | +| Stacked Cox Regression | Approximates time-to-event modeling by expanding survival data into risk-set rows and fitting logistic regression with time-bin indicators. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/cox_regression_stacked.md) | ## Machine Learning | Algorithm | Description | Documentation | |---|---|---| -| K-means | Partitions observations into clusters using numerical variables and squared Euclidean distance. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/k-means.md) | -| Principal Component Analysis | Computes principal components using global standardization and eigendecomposition of the aggregated covariance matrix. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/PCA.md) | -| PCA with Transformations | Applies selected per-variable transformations before computing principal components. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/PCAWithTransformation.md) | -| Gaussian Naive Bayes | Classifies observations with numerical features by modeling each feature as Gaussian within each class. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/NaiveBayesGaussian.md) | -| Gaussian Naive Bayes K-fold Cross-validation | Evaluates Gaussian Naive Bayes with K-fold cross-validation and returns confusion-matrix and fold-level metrics. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/NaiveBayesGaussianCV.md) | -| Categorical Naive Bayes | Classifies observations with nominal features by estimating class-conditional category probabilities. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/NaiveBayesCategorical.md) | -| Categorical Naive Bayes K-fold Cross-validation | Evaluates categorical Naive Bayes with K-fold cross-validation and returns confusion-matrix and fold-level metrics. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/NaiveBayesCategoricalCV.md) | -| Linear SVM | Fits linear support vector classifiers at each site and averages learned coefficients and intercepts. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/SVM.md) | -| Federated Averaging | Combines model parameters learned separately at multiple sites by averaging each named parameter array. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/FederatedAveraging.md) | +| K-means | Partitions observations into clusters using numerical variables and squared Euclidean distance. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/k-means.md) | +| Principal Component Analysis | Computes principal components using global standardization and eigendecomposition of the aggregated covariance matrix. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/PCA.md) | +| Gaussian Naive Bayes | Classifies observations with numerical features by modeling each feature as Gaussian within each class. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/NaiveBayesGaussian.md) | +| Gaussian Naive Bayes K-fold Cross-validation | Evaluates Gaussian Naive Bayes with K-fold cross-validation and returns confusion-matrix and fold-level metrics. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/NaiveBayesGaussianCV.md) | +| Categorical Naive Bayes | Classifies observations with nominal features by estimating class-conditional category probabilities. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/NaiveBayesCategorical.md) | +| Categorical Naive Bayes K-fold Cross-validation | Evaluates categorical Naive Bayes with K-fold cross-validation and returns confusion-matrix and fold-level metrics. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/NaiveBayesCategoricalCV.md) | +| Linear SVM | Fits linear support vector classifiers at each site and averages learned coefficients and intercepts. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/SVM.md) | +| Federated Averaging | Combines model parameters learned separately at multiple sites by averaging each named parameter array. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/FederatedAveraging.md) | ## Preprocessing -| Algorithm | Description | Documentation | +| Step | Description | Documentation | |---|---|---| -| Preprocessing Steps | Documents missing-value handling, outlier winsorization, longitudinal transformations, and reusable K-means cluster columns used before downstream algorithms. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/PreprocessingSteps.md) | -| Outlier Winsorizer | Clips selected numerical variables to bounds computed from Gaussian, IQR, MAD, or quantile rules. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/outlier_winsorizer.md) | -| K-means Column Creator | Reuses a fitted K-means result to assign a categorical cluster column for downstream analyses. | [Documentation](https://github.com/madgik/exaflow/blob/master/documentation/algorithms/PreprocessingSteps.md#kmeans-cluster-creation) | +| Preprocessing Steps | Covers missing-value handling, outlier winsorization, longitudinal transformations, and categorical column creation. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/PreprocessingSteps.md) | +| Outlier Winsorizer | Clips selected numerical variables to bounds computed from Gaussian, IQR, MAD, or quantile rules. | [Documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/outlier_winsorizer.md) | +| PCA Column Creator | Creates numerical principal component score columns for downstream analyses. Fit PCA on selected numerical variables or reuse a fitted PCA result. | [PCA documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/PCA.md#application-integration) | +| K-means Column Creator | Creates a categorical cluster column for downstream analyses. Fit K-means on selected numerical variables or reuse fitted cluster centers. | [K-means documentation](https://github.com/madgik/exaflow/blob/1.4.0/documentation/algorithms/k-means.md#k-means-as-preprocessing) | -The UI also supports creating categorical columns with filter-based category -rules in the Data Handling step. Researchers can use the prepared variables in -subsequent analyses through the Experiment Studio or the -[notebook workspace](notebooks.md). +In the Analysis Studio, add PCA or K-means columns in the Transformation panel, +then select those columns as inputs to a downstream algorithm. The panel also +supports categorical columns defined by filter-based rules. To prepare variables +before running PCA, configure the applicable preprocessing steps and select the +standard PCA algorithm. See the [notebook guide](notebooks.md) for using +preprocessing in Python. diff --git a/documentation/notebook-operator.md b/documentation/notebook-operator.md index 45b314b8..dff250be 100644 --- a/documentation/notebook-operator.md +++ b/documentation/notebook-operator.md @@ -1,8 +1,10 @@ # Notebook operator -JupyterHub no longer creates pods or PVCs. It creates a `Notebook` custom -resource; the MIP notebook operator (`operator/`, Operator SDK `go/v4`) turns it -into a pod and a PVC from a `NotebookProfile` the hub cannot edit. +The MIP notebook operator provisions a pod and PVC from a `Notebook` custom +resource and its `NotebookProfile`. With `jupyterhub.spawner: operator`, the hub +creates the custom resource directly. With `jupyterhub.spawner: operator-api`, +the hub calls the operator's HTTPS spawn API without Kubernetes API access. +The Helm chart defaults to `kubespawner`. [Kubernetes configuration](../deployment/kubernetes/README.md#configuration) ## Why diff --git a/documentation/notebooks.md b/documentation/notebooks.md index d1b36ce0..154e24fd 100644 --- a/documentation/notebooks.md +++ b/documentation/notebooks.md @@ -1,6 +1,6 @@ -# Jupyter Notebooks and Cohort Scout +# Jupyter notebooks, the MIP Python client, and Cohort Scout -MIP now offers a JupyterLab workspace alongside the web analysis workflow. +MIP offers a JupyterLab workspace alongside the web analysis workflow. Notebooks combine Python code, analysis results, visualizations, and explanatory text so researchers can develop and revisit reproducible federated analyses. @@ -16,7 +16,8 @@ text so researchers can develop and revisit reproducible federated analyses. apply filters and preprocessing, and run algorithms with the `mip` client. 5. Save personal notebooks and analysis scripts in `scratch/`. -The workspace includes a pre-installed Python client and session configuration: +The workspace includes the `mip-client` package and configures the connection +for your notebook session. ```python import mip @@ -27,8 +28,39 @@ catalog = client.catalog() The client exposes analysis selections and pipelines for filters, missing-value handling, outlier treatment, and reusable K-means cluster columns. Notebook -requests go through the platform backend and its access controls to Exaflow; -patient-level records remain at the contributing sites. +requests go through the platform backend and its access controls to Exaflow. +Patient-level records remain at the contributing sites. + +## Use MIP from your own computer + +Use the same Python client from scripts or notebooks on your own computer or +server. Remote sign-in requires a MIP deployment that has enabled local-client +access. The client uses the dataset permissions assigned to your portal account. + +Install the 0.3.0 client from the release tag with Python 3.10–3.12 and Git. + +```bash +python -m pip install "mip-client @ git+https://github.com/Medical-Informatics-Platform/mip-jupyter@0.3.0#subdirectory=python-client" +``` + +Replace `https://mip.example.org` with the HTTPS URL of your MIP portal and +run `mip login https://mip.example.org`. Open the link it prints, check that the +code matches, and approve the sign-in. On a headless machine, create an access +token on the portal's account page, run `mip login --token https://mip.example.org`, +and paste the token when prompted. + +Once signed in, run `mip catalog` to list the data models you can access, or +import `mip` and call `mip.Client.from_env()` in a Python script. Use `mip logout` +to end the sign-in for that computer. [Remote access and troubleshooting](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.3.0/docs/user/remote-access.md) + +### Work with an AI assistant + +Run `mip agent init` in your project directory to generate `AGENTS.md` and a +`CLAUDE.md` that points to it. Your assistant can use `mip guide`, `mip catalog`, +`mip search-variables`, and `mip algorithms` to find guidance and prepare Python +analyses. Use an assistant approved for the data and results you share with it. +These commands are available wherever you install the client. Cohort Scout is +available in the hosted notebook workspace when configured. ## Notebook support agent @@ -45,12 +77,12 @@ Example requests include: ## Repository and further reading -The new [mip-jupyter repository](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.2.1) -contains the workspace template, Python client, user guides, Jupyter images, and -assistant integration. Example notebooks live in the -[mip-examples repository](https://github.com/Medical-Informatics-Platform/mip-examples). +The workspace template, Python client, Jupyter images, and assistant integration +ship together. Example notebooks are maintained in a separate repository. +[mip-jupyter 0.3.0](https://github.com/Medical-Informatics-Platform/mip-jupyter/tree/0.3.0) · +[mip-examples](https://github.com/Medical-Informatics-Platform/mip-examples) -- [Quickstart](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.2.1/docs/user/quickstart.md) -- [Python client API reference](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.2.1/docs/user/api-reference.md) -- [Workspace guide](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.2.1/docs/user/workspace-guide.md) -- [Operator integration guide](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.2.1/docs/operators.md) +- [Quickstart](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.3.0/docs/user/quickstart.md) +- [Python client API reference](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.3.0/docs/user/api-reference.md) +- [Workspace guide](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.3.0/docs/user/workspace-guide.md) +- [Operator integration guide](https://github.com/Medical-Informatics-Platform/mip-jupyter/blob/0.3.0/docs/operators.md)