File size: 2,065 Bytes
c0a7163
 
 
 
 
c7e27e5
c0a7163
 
 
 
 
 
 
 
 
 
 
 
c7e27e5
 
 
 
 
c0a7163
c7e27e5
c0a7163
 
 
c7e27e5
c0a7163
 
c7e27e5
 
 
 
 
 
 
 
 
 
c0a7163
 
c7e27e5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c00e850
c0a7163
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
set -eu

mkdir -p data/raw data/processed data/knowledge_base/seed

# Seed raw fixtures so the Signal/Image/Molecule tabs work on first click.
if [ -f tests/fixtures/bbbp_sample.csv ] && [ ! -f data/raw/bbbp.csv ]; then
  cp tests/fixtures/bbbp_sample.csv data/raw/bbbp.csv
fi

if [ -f tests/fixtures/eeg_sample.fif ] && [ ! -f data/raw/eeg.fif ]; then
  cp tests/fixtures/eeg_sample.fif data/raw/eeg.fif
fi

if [ -d tests/fixtures/kb_sample ] && [ ! -f data/knowledge_base/seed/lipinski_rule_of_five.md ]; then
  cp tests/fixtures/kb_sample/* data/knowledge_base/seed/
fi

# Demo-time stub artifacts (MRI 2D / volumetric ONNX / EEG joblib / clinical
# RAG / axial PNG). Idempotent — only fills missing.
python scripts/seed_demo_artifacts.py || true

# BBB feature extraction + classifier training (idempotent).
if [ ! -f data/processed/bbbp_features.parquet ]; then
  NEUROBRIDGE_DISABLE_MLFLOW=1 python -m src.pipelines.bbb_pipeline || true
fi

if [ ! -f data/processed/bbb_model.joblib ]; then
  NEUROBRIDGE_DISABLE_MLFLOW=1 python -m src.models.bbb_model || true
fi

# EEG feature extraction (idempotent).
if [ ! -f data/processed/eeg_features.parquet ]; then
  NEUROBRIDGE_DISABLE_MLFLOW=1 python -c "
from pathlib import Path
from src.pipelines.eeg_pipeline import run_pipeline
run_pipeline(
    input_path=Path('tests/fixtures/eeg_sample.fif'),
    output_path=Path('data/processed/eeg_features.parquet'),
)
" || true
fi

# MRI feature extraction + ComBat harmonization (idempotent).
if [ ! -f data/processed/mri_features.parquet ]; then
  NEUROBRIDGE_DISABLE_MLFLOW=1 python -c "
from pathlib import Path
from src.pipelines.mri_pipeline import run_pipeline
run_pipeline(
    input_dir=Path('tests/fixtures/mri_sample'),
    sites_csv=Path('tests/fixtures/mri_sample/sites.csv'),
    output_path=Path('data/processed/mri_features.parquet'),
)
" || true
fi

# RAG FAISS index build (idempotent).
if [ ! -f data/processed/faiss_index/index.bin ]; then
  python -m src.rag.ingest data/knowledge_base data/processed/faiss_index || true
fi

exec "$@"