Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions PORTABILITY_PATH_INVENTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Path portability inventory

Active utility defaults now resolve through `ecosystem_path.sh`: `OMNIBIOAI_ROOT` takes precedence, otherwise the parent of this repository is used. Positional root arguments remain supported where they existed.

The obsolete `Desktop/machine` references found in active utilities were replaced in the build, backup, coverage, startup, sync, sweep, audit, and data helper scripts. Historical cron examples, generated `build-results.txt`, migration notes, test fixtures, and PubMed archival documentation retain their original paths as records of past runs. Ordinary identifiers and unrelated prose were left unchanged.

Validation covers default resolution, an override containing spaces, Bash syntax, Python compilation, and `git diff --check`. No backup, restore, sync, build, deployment, or stack-start command was executed.
12 changes: 12 additions & 0 deletions ecosystem_path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Shared portable ecosystem path resolution for utility scripts.
# OMNIBIOAI_ROOT wins; otherwise derive the ecosystem root from this checkout.
if [[ -z "${OMNIBIOAI_UTILS_DIR:-}" ]]; then
OMNIBIOAI_UTILS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
fi
omni_resolve_root() {
if [[ -n "${OMNIBIOAI_ROOT:-}" ]]; then printf '%s\n' "$OMNIBIOAI_ROOT"; return; fi
printf '%s\n' "$(cd "$OMNIBIOAI_UTILS_DIR/.." && pwd)"
}
OMNIBIOAI_ROOT="$(omni_resolve_root)"
export OMNIBIOAI_ROOT
9 changes: 5 additions & 4 deletions omnibioai-up.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -euo pipefail

SESSION="omnibioai"

# Base paths (repos)
OMNI_CORE=~/Desktop/machine/omnibioai
OMNI_TES=~/Desktop/machine/omnibioai-tes
OMNI_TOOL=~/Desktop/machine/omnibioai-toolserver
OMNI_LIMS=~/Desktop/machine/omnibioai-lims
OMNI_CORE="$OMNIBIOAI_ROOT"/omnibioai
OMNI_TES="$OMNIBIOAI_ROOT"/omnibioai-tes
OMNI_TOOL="$OMNIBIOAI_ROOT"/omnibioai-toolserver
OMNI_LIMS="$OMNIBIOAI_ROOT"/omnibioai-lims

# Optional: load your env (uncomment + set the right file if you use one)
# [ -f ~/.bashrc ] && source ~/.bashrc
Expand Down
3 changes: 2 additions & 1 deletion prepare_hipaa_audit.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -uo pipefail

ROOT="${1:-$HOME/Desktop/machine}"
ROOT="${1:-$OMNIBIOAI_ROOT}"

echo
echo "=============================================================="
Expand Down
4 changes: 2 additions & 2 deletions pubmed/create_new_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from pathlib import Path
from datetime import datetime

DATA_DIR = Path("/home/manish/Desktop/machine/data/PubMed/Abstracts")
STATE_FILE = Path("/home/manish/Desktop/machine/data/PubMed/sync_state.json")
DATA_DIR = Path(os.path.join(os.environ.get("OMNIBIOAI_ROOT", str(Path(__file__).resolve().parents[2])), "data", "PubMed", "Abstracts"))
STATE_FILE = Path(os.path.join(os.environ.get("OMNIBIOAI_ROOT", str(Path(__file__).resolve().parents[2])), "data", "PubMed", "sync_state.json"))
CHUNK_SIZE = 500000

def get_updated_pmids():
Expand Down
3 changes: 2 additions & 1 deletion pubmed/reindex_one_shard.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
#!/usr/bin/env python3

"""
Expand All @@ -22,7 +23,7 @@
# Configuration
SHARD = "_general_corpus_chunk100"

PUBMED_DIR = Path("/home/manish/Desktop/machine/data/PubMed")
PUBMED_DIR = Path(os.path.join(os.environ.get("OMNIBIOAI_ROOT", str(Path(__file__).resolve().parents[2])), "data", "PubMed"))

INPUT_DIR = PUBMED_DIR / "Abstracts" / SHARD
STAGING_DIR = PUBMED_DIR / "Index" / "_reindex_staging" / SHARD
Expand Down
3 changes: 2 additions & 1 deletion pubmed/reindex_one_shard_ollama.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
#!/usr/bin/env python3

"""
Expand All @@ -18,7 +19,7 @@
SHARD = "_general_corpus_chunk100"

PUBMED_DIR = Path(
"/home/manish/Desktop/machine/data/PubMed"
os.path.join(os.environ.get("OMNIBIOAI_ROOT", str(Path(__file__).resolve().parents[2])), "data", "PubMed")
)

INPUT_DIR = PUBMED_DIR / "Abstracts" / SHARD
Expand Down
3 changes: 2 additions & 1 deletion pubmed/run_chunks.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/ecosystem_path.sh"
# run_chunks.sh
# Runs embedding_engine.py over each _general_corpus_chunk* study,
# capping concurrency to avoid repeating the OOM/swap situation.

set -euo pipefail

PARENT="/home/manish/Desktop/machine/omnibioai-data/PubMed/Abstracts"
PARENT="$OMNIBIOAI_ROOT/omnibioai-data/PubMed/Abstracts"
CHUNK_PREFIX="_general_corpus_chunk"
MAX_CONCURRENT=1 # tune based on observed RSS per chunk; start conservative
EMBED_MODEL="pubmedbert"
Expand Down
3 changes: 2 additions & 1 deletion pubmed/split_general_corpus.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/ecosystem_path.sh"
# split_general_corpus.sh
# Splits _general_corpus/*.json into chunk subdirectories of CHUNK_SIZE files each,
# so ragbio.embeddings.embedding_engine can be run per-chunk via --study <chunk_name>
# without any code changes.

set -euo pipefail

SRC="/home/manish/Desktop/machine/omnibioai-data/PubMed/Abstracts/_general_corpus"
SRC="$OMNIBIOAI_ROOT/omnibioai-data/PubMed/Abstracts/_general_corpus"
PARENT="$(dirname "$SRC")"
CHUNK_SIZE=500000
CHUNK_PREFIX="_general_corpus_chunk"
Expand Down
7 changes: 4 additions & 3 deletions run_coverage.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
MACHINE=~/Desktop/machine
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
MACHINE="$OMNIBIOAI_ROOT"
OUT=$MACHINE/out/coverage
mkdir -p $OUT
find $MACHINE -name "coverage.json" -exec chmod 666 {} \; 2>/dev/null
Expand Down Expand Up @@ -107,7 +108,7 @@ merged = {
}
}

out = os.path.expanduser("~/Desktop/machine/out/coverage/omnibioai.json")
out = os.path.join(os.environ.get("OMNIBIOAI_ROOT", ""), "out/coverage/omnibioai.json")
with open(out, "w") as f:
json.dump(merged, f, indent=2)
print(f" ✅ omnibioai merged: {total_covered}/{total_stmts} = {total_pct:.2f}%")
Expand All @@ -121,7 +122,7 @@ echo ""
python3 - <<'EOF'
import json, os, glob

out_dir = os.path.expanduser("~/Desktop/machine/out/coverage")
out_dir = os.path.join(os.environ.get("OMNIBIOAI_ROOT", ""), "out/coverage")
SKIP = {"omnibioai-services.json", "omnibioai-plugins.json"}
THRESHOLD = 90.0

Expand Down
3 changes: 2 additions & 1 deletion start-all-uis.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -e
BASE=$HOME/Desktop/machine
BASE="$OMNIBIOAI_ROOT"
echo 'Starting OmniBioAI backend APIs...'

# Workflow bundles backend
Expand Down
3 changes: 2 additions & 1 deletion start_all.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -e

echo "=============================="
echo "Starting OmniBioAI stack"
echo "=============================="

ROOT=~/Desktop/machine
ROOT="$OMNIBIOAI_ROOT"

# ----------------------------
# Start omnibioai-tes
Expand Down
3 changes: 2 additions & 1 deletion start_stack_tmux.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -euo pipefail

ROOT="$HOME/Desktop/machine"
ROOT="$OMNIBIOAI_ROOT"
UTILS="$ROOT/utils/kill_port.sh"

# Ports
Expand Down
5 changes: 3 additions & 2 deletions sweep_all_repos.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -uo pipefail

# Scans every sibling repo under MACHINE_DIR for leftover ghcr.io/man4ish
# references, using the same logic as update_ghcr_refs.sh (dry-run only,
# same exclusions for release/, obsolete/, node_modules/, work/, *.log etc).
# Prints a per-repo summary so you can decide where to actually apply the fix.

MACHINE_DIR="${1:-$HOME/Desktop/machine}"
MACHINE_DIR="${1:-$OMNIBIOAI_ROOT}"
UPDATE_SCRIPT="$(cd "$(dirname "$0")" && pwd)/update_ghcr_refs.sh"

if [ ! -f "$UPDATE_SCRIPT" ]; then
Expand Down Expand Up @@ -73,4 +74,4 @@ else
echo " Review: bash $UPDATE_SCRIPT ${MACHINE_DIR}/${r}"
echo " Apply: bash $UPDATE_SCRIPT ${MACHINE_DIR}/${r} --apply"
done
fi
fi
3 changes: 2 additions & 1 deletion sync_all_repos.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"

#!/usr/bin/env bash

set -u

ROOT="${1:-$HOME/Desktop/machine}"
ROOT="${1:-$OMNIBIOAI_ROOT}"

REPOS=(
"omnibioai-api-gateway"
Expand Down
3 changes: 2 additions & 1 deletion test_split_on_sample.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/ecosystem_path.sh"
set -euo pipefail

SRC_REAL="${SRC_REAL:-/home/manish/Desktop/machine/omnibioai-data/PubMed/Abstracts/_general_corpus}"
SRC_REAL="${SRC_REAL:-$OMNIBIOAI_ROOT/omnibioai-data/PubMed/Abstracts/_general_corpus}"
SAMPLE_SIZE=20
TEST_ROOT="/tmp/gc_split_test_$$"
SRC="${TEST_ROOT}/_general_corpus"
Expand Down
8 changes: 8 additions & 0 deletions tests/test_ecosystem_path.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
repo="$(cd "$(dirname "$0")/.." && pwd)"
expected="$(cd "$repo/.." && pwd)"
actual="$(env -u OMNIBIOAI_ROOT bash -c 'source "$1/ecosystem_path.sh"; printf "%s" "$OMNIBIOAI_ROOT"' _ "$repo")"
[[ "$actual" == "$expected" ]]
override="$(OMNIBIOAI_ROOT="/tmp/root with spaces" bash -c 'source "$1/ecosystem_path.sh"; printf "%s" "$OMNIBIOAI_ROOT"' _ "$repo")"
[[ "$override" == "/tmp/root with spaces" ]]
Loading