query-entity-export / package_bundle.sh
anurag-raapid's picture
Upload folder using huggingface_hub
fd1eb5a verified
Raw
History Blame Contribute Delete
1.72 kB
#!/usr/bin/env bash
# Create a shareable copy of the bundle (no venv, no caches, no sample outputs).
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PARENT="$(dirname "$ROOT")"
BUNDLE_NAME="query_entity_export_bundle"
OUT_DIR="${1:-$PARENT/${BUNDLE_NAME}_share}"
ARCHIVE="${OUT_DIR}.zip"
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR"
rsync -a \
--exclude '.venv-quickumls/' \
--exclude '.venv/' \
--exclude '.git/' \
--exclude '.vscode/' \
--exclude '__pycache__/' \
--exclude '*.pyc' \
--exclude 'results/query_entity_detections_*.json' \
--exclude "${BUNDLE_NAME}_share/" \
--exclude '*.zip' \
"$ROOT/" "$OUT_DIR/"
# Ensure results dir exists but stays empty of prior runs
mkdir -p "$OUT_DIR/results"
touch "$OUT_DIR/results/.gitkeep"
cat > "$OUT_DIR/SHARE_README.txt" <<'EOF'
Query Entity Export Bundle — shared copy
======================================
This folder does NOT include .venv-quickumls (machine-specific).
Your colleague must create it locally:
cd query_entity_export_bundle_share # or whatever this folder is named
./setup.sh
export ICD_QUICKUMLS_DATA_DIR="/path/to/quickumls_data"
./run_export.sh --query "Type II Diabetes Mellitus Uncontrolled"
See README.md and SETUP.md for full instructions.
QuickUMLS data (~5 GB) is NOT bundled — each site must use their own
UMLS-licensed quickumls_data/ directory.
EOF
echo "Created shareable bundle: $OUT_DIR"
du -sh "$OUT_DIR"
if command -v zip >/dev/null 2>&1; then
rm -f "$ARCHIVE"
(cd "$PARENT" && zip -rq "$(basename "$ARCHIVE")" "$(basename "$OUT_DIR")")
echo "Created archive: $ARCHIVE ($(du -sh "$ARCHIVE" | cut -f1))"
else
echo "zip not found — folder only (no archive)."
fi