Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e4b36f9
feat: update .gitignore to ignore .next
emiridbest Sep 17, 2026
78b6254
feat: update AGENTS.md with researcher UI/frontend details
emiridbest Sep 17, 2026
b943691
feat: bacth-commiting the first iteration of the UI
emiridbest Sep 17, 2026
fe65753
fix: commit all remote changes to fix merge conflict
emiridbest Sep 17, 2026
9697480
fix(ui): preserve filters and disclosure boundaries
emiridbest Sep 17, 2026
a3eb523
fix(ui): style withheld and unavailable states
emiridbest Sep 17, 2026
8c4ecf8
chore(frontend): repair npm lockfile for clean installs
emiridbest Sep 17, 2026
b5e4ed7
docs: resolve AGENTS merge conflict
emiridbest Sep 17, 2026
20e1068
fix(ui): withhold held counts and handle empty results
vbabenko97 Sep 17, 2026
b05bac2
Merge main and preserve frontend and data ignore rules
vbabenko97 Sep 17, 2026
1f7a2ed
feat: add all upstream update
emiridbest Sep 18, 2026
c531092
Merge branch 'main' of https://github.com/emiridbest/Federated_APIs i…
emiridbest Sep 18, 2026
d8f3c7d
feat: merge all remote update
emiridbest Sep 18, 2026
bf4b3fc
feat: merge remote updates
emiridbest Sep 18, 2026
89c4c56
feat: add support for logistic regression and validate all API integr…
emiridbest Sep 18, 2026
a2d71e2
feat: merge all remote chnages
emiridbest Sep 18, 2026
06e4f10
Merge branch 'main' of https://github.com/emiridbest/Federated_APIs i…
emiridbest Sep 18, 2026
549d3b0
frontend: use /api proxy, support fed_logreg, and unify result rendering
emiridbest Sep 18, 2026
4dcc15d
feat: merge remote updates
emiridbest Sep 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,23 @@ flare/jobs/
flare/kits/
.local_fed/
.next
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> b05bac27146e3cacfc9e8a99a06e67a2150ddf78
*.csv
*.bed
*.bim
*.fam
*_geno.*
site*_nordik_sim.*
<<<<<<< HEAD
.remote/
server/api_out/
frontend/.next/
frontend/AGENTS.md
frontend/CLAUDE.md
>>>>>>> 1589cd5ef94e40e0c3866ba2b7a45973a101a81c
=======
>>>>>>> b05bac27146e3cacfc9e8a99a06e67a2150ddf78
10 changes: 10 additions & 0 deletions data/ground_truth.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,23 @@
"snp_rs013"
],
"coef": {
<<<<<<< HEAD
"intercept": 89.2728860425527,
"age": 0.5055436521435493,
"sex": 4.203368841196912,
"bmi": 0.8062409982940054,
"ldl": 1.2189188961362305,
"snp_rs001": 2.3934157478351294,
"snp_rs007": -1.2816779284343325,
=======
"intercept": 89.27288604255267,
"age": 0.5055436521435472,
"sex": 4.203368841196912,
"bmi": 0.8062409982940094,
"ldl": 1.2189188961362498,
"snp_rs001": 2.3934157478351223,
"snp_rs007": -1.2816779284343316,
>>>>>>> fffe7185c787e67d9476d0f02c3d2469b8e2b5f0
"snp_rs013": 0.9002997078401026
}
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8080
28 changes: 15 additions & 13 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,25 @@ npm install
npm run dev
```

The UI uses Webpack mode because the native Windows SWC binary may be unavailable. Set `NEXT_PUBLIC_API_BASE_URL` when the API is not running at `http://localhost:8500`:
The UI uses Webpack mode because the native Windows SWC binary may be unavailable. Browser requests use the same-origin `/api` proxy, so the browser does not need CORS access to the Python API. The proxy targets `http://127.0.0.1:8080` by default. Set `BACKEND_API_URL` in the frontend environment to override it:

```powershell
$env:NEXT_PUBLIC_API_BASE_URL = "http://localhost:8500"
$env:BACKEND_API_URL = "http://127.0.0.1:8080"
```

The expected API surface is:
The current backend API surface is:

- `GET /metadata` — canonical variables, safe projects, examples, and TRE status.
- `GET /examples/{filename}` — load an example `AnalysisSpec`.
- `POST /run` — submit an `AnalysisSpec`; returns a run ID.
- `GET /run/{id}` — poll status and read the merged server result.
- `GET /overseer` — read flagged results.
- `POST /overseer/{spec_hash}/approve` and `/reject` — release or reject a queued result.
- `GET /audit` — read per-site audit records.
- `GET /health`
- `GET /allele-frequency?variant=...&project_id=...&min_cell_size=...`
- `POST /linear-regression` with `features`, `target`, `project_id`, `filters`, and `min_cell_size`.
- `POST /logistic-regression` with `features`, `target`, `project_id`, `filters`, and `min_cell_size`.

The result renderer follows the server output fields: `coverage`, `sites_missing`, `n_per_site`, `rejected_per_site`, and `stats` containing allele frequencies, genotype counts, summary statistics, OLS coefficients, and FedAvg history. The TRE list is supplied by the API; the frontend does not read site CSVs or import TRE applications.
The Next.js route at `app/api/[...path]/route.js` forwards those requests server-side, avoiding browser CORS. Metadata, example loading, run polling, overseer, and audit routes are not exposed by the current backend, so the UI uses static variable/project choices and the existing example selector includes a `logistic_regression` mode for the new endpoint.

(From the docs, I mean the global README)
The Python backend and local TREs are started from the repository root. For the simulated TRE path, run `python scripts/dev_tres.py`, then start the API on port 8500.
Start the Python API from the repository root on port 8080, then start this frontend:

```powershell
python -m uvicorn server.api:app --host 127.0.0.1 --port 8080 --workers 1
cd frontend
npm run dev
```
23 changes: 23 additions & 0 deletions frontend/app/api/[...path]/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const backendBase = process.env.BACKEND_API_URL || process.env.NEXT_PUBLIC_API_BASE_URL || 'http://127.0.0.1:8080'

async function forward(request, context) {
const { path = [] } = await context.params
const target = new URL(`/${path.join('/')}`, `${backendBase.replace(/\/$/, '')}/`)
target.search = new URL(request.url).search

const headers = new Headers()
const contentType = request.headers.get('content-type')
if (contentType) headers.set('content-type', contentType)

const body = request.method === 'GET' || request.method === 'HEAD' ? undefined : await request.arrayBuffer()
const response = await fetch(target, { method: request.method, headers, body, cache: 'no-store' })
const responseHeaders = new Headers()
const responseType = response.headers.get('content-type')
if (responseType) responseHeaders.set('content-type', responseType)

return new Response(response.body, { status: response.status, headers: responseHeaders })
}

export const GET = forward
export const POST = forward
export const OPTIONS = () => new Response(null, { status: 204 })
Loading
Loading