Flower AI Summit 2026·April 15–16·London

@owkin/fedeca

4
0
flwr new @owkin/fedeca

FedECA

This app implements the FedECA method using Flower Flower. For demonstration, it makes use of a synthetic right-censored time-to-event dataset with 10 covariates. FedECA runs in both simulation and deployment modes. By default, it runs without bootstrapping and reports results with naïve and robust variance estimates, both after 10 Newton-Raphson steps. Bootstrapping can be enabled by setting the bootstrap parameter in pyproject.toml to true. Both global (default) and per-client bootstrapping are supported.

Please consider citing our paper if you use the app (see the bottom of the page for the bibtex version)!

Get the app

On a new environment with Python 3.10-3.12, install Flower:

pip install flwr

Then, download this app and install its dependencies:

# Fetch the app
flwr new @owkin/fedeca

# Install dependencies
cd fedeca && pip install -e .

The structure of your FedECA app is as follows:

fedeca
├── fedeca_flower
│   ├── __init__.py
│   ├── client_app.py   # Defines your ClientApp
│   ├── server_app.py   # Defines your ServerApp
│   └── fedeca          # Directory with FedECA utility modules
├── pyproject.toml      # Project metadata like dependencies and configs
├── LICENSE.md
└── README.md

Run FedECA with the Simulation Engine

TIP

To run FedECA you first need to source some data. You can find a synthetic dataset for four centers/nodes ready to be used in the companion GitHub repository for this app. Download the data directory.

First, copy the data directory inside your app directory. It is expected to be located in the same directory where the pyproject.toml is. You could place data somewhere else in your system, but if you wish to do so you'll need to edit the path-to-data in the [tool.flwr.app.config] of the pyproject.toml accordingtly.

Before launching the simulation, we need to define a SuperLink Connection in the . This helps you define the size of your simulation (4 nodes in this case), among other settings. To do this, let's first locate the Flower Configuration file and then edit it.

Locate the Flower Configuration file:

flwr config list
# Example output:
Flower Config file: /path/to/your/.flwr/config.toml
SuperLink connections:
 supergrid
 local (default)

Edit the local configuration so it looks like the following. It defines 4 virtual SuperNodes (one per dataset partition in the example data/ directory):

[superlink.local]
options.num-supernodes = 4 # <----------- 4 centers data for your simulation
options.backend.client-resources.num-cpus = 1
options.backend.client-resources.num-gpus = 0.0

With the updated [superlink.local] and the data ready, simply run the app:

flwr run .

You will see a log like the following:

Loading project configuration...
Success
INFO :      (iter: 0) Success after 5 FedCox steps (norm_delta = 6.527887117250224e-09)
-------------- FedECA (naïve) ---------------
       coef  se(coef)  coef lower 95%  coef upper 95%         z         p  exp(coef)  exp(coef) lower 95%  exp(coef) upper 95%
0  0.041718  0.049127        -0.05457        0.138005  0.849178  0.395782     1.0426             0.946892             1.147981
-------------- FedECA (robust) ---------------
       coef  se(coef)  coef lower 95%  coef upper 95%         z         p  exp(coef)  exp(coef) lower 95%  exp(coef) upper 95%
0  0.041718  0.070581       -0.096618        0.180054  0.591062  0.554479     1.0426             0.907902             1.197282

The default configuration (see [tool.flwr.app.config] in the pyproject.toml) runs for just a few iterations. You can override all those settings to run FedECA for more interations and use different boostrapping methods. For example:

# Perform 200 iterations with per-client bootstrapping
flwr run . --run-config="bootstrap=true bootstrap-iterations=200 bootstrap-fn='per-client'"

# Will report a summary:
-------------- Bootstrap FedECA (n_iter = 200 + 1) ---------------
       coef  se(coef)  coef lower 95%  coef upper 95%        z         p  exp(coef)  exp(coef) lower 95%  exp(coef) upper 95%
0  0.041718  0.037539       -0.031857        0.115292  1.11132  0.266431     1.0426             0.968645             1.122202

Run FedECA with the Deployment Engine

NOTE

To learn more about Flower's Deployment Runtime (including configuring TLS, node authentication or run with Docker) check the Flower Documentation.

Assuming you have a SuperLink already runnig, connect SuperNodes to it as follows:

# This SuperNode will load center-0 data.
flower-supernode --address=<SUPERLINK-ADDRESS> --node-config='partition-id=0'

Run FedECA with your own data

When the FedECA app runs, in simulation or deployment mode, the ClientApps load the appropriate datasets by following the data path template defined in the [tool.flwr.app.config] section of the pyproject.toml as:

[tool.flwr.app.config]
...
path-to-data = "data/center{}/data.csv"

Then, at runtime, each ClientApp completes that path with their respective partition id.

To test FedECA with your own data (currently only csv files are supported):

  1. Partition your data on a per-center basis into different csv files. For examle, name them partition1.csv, partition2.csv, etc.
  2. In the pyproject.toml, set path-to-data = "path/to/my/partition{}.csv". Alternatively, you can override this setting at runtime as:
    flwr run . --run-config="path-to-data='path/to/my/partition{}.csv'"
  3. Optionally, if run with the Simulation Engine, make sure the options.num-supernodes in your Flower Configuration sets the appropriate number of supernodes equal to the number of data partitions. Refer to the Simulation Documentation for more details. If run with the Deployment Engine, make sure the compose.yaml file is spawning enough SuperNodes.

Citing FedECA

@article{OgierduTerrail2025,
  author = {Jean Ogier du Terrail and Quentin Klopfenstein and Honghao Li and Imke Mayer and Nicolas Loiseau and Mohammad Hallal and Michael Debouver and Thibault Camalon and Thibault Fouqueray and Jorge Arellano Castro and Zahia Yanes and Laëtitia Dahan and Julien Taïeb and Pierre Laurent-Puig and Jean-Baptiste Bachet and Shulin Zhao and Remy Nicolle and Jérôme Cros and Daniel Gonzalez and Robert Carreras-Torres and Adelaida Garcia Velasco and Kawther Abdilleh and Sudheer Doss and Félix Balazard and Mathieu Andreux},
  title = {FedECA: federated external control arms for causal inference with time-to-event data in distributed settings},
  journal = {Nature Communications},
  year = {2025},
  volume = {16},
  number = {1},
  pages = {7496},
  doi = {10.1038/s41467-025-62525-z},
  url = {https://doi.org/10.1038/s41467-025-62525-z},
  abstract = {External control arms can inform early clinical development of experimental drugs and provide efficacy evidence for regulatory approval. However, accessing sufficient real-world or historical clinical trials data is challenging. Indeed, regulations protecting patients’ rights by strictly controlling data processing make pooling data from multiple sources in a central server often difficult. To address these limitations, we develop a method that leverages federated learning to enable inverse probability of treatment weighting for time-to-event outcomes on separate cohorts without needing to pool data. To showcase its potential, we apply it in different settings of increasing complexity, culminating with a real-world use-case in which our method is used to compare the treatment effect of two approved chemotherapy regimens using data from three separate cohorts of patients with metastatic pancreatic cancer. By sharing our code, we hope it will foster the creation of federated research networks and thus accelerate drug development.},
  issn = {2041-1723}
}