From 18fd0c778533c168e89be212426811229ebf1a63 Mon Sep 17 00:00:00 2001 From: Rahul Narla Date: Tue, 24 Feb 2026 12:22:09 -0800 Subject: [PATCH] script: pull vocab locally --- .gitignore | 5 ++++- scripts/sync-vocabulary.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) create mode 100755 scripts/sync-vocabulary.sh diff --git a/.gitignore b/.gitignore index 1a533534..ca019c35 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ .classpath /src/main/profiles/local/ /bin -/reference-ccda-api \ No newline at end of file +/reference-ccda-api + +# Validator data (configs, vocabulary, scenarios) – populated by scripts or locally +/validator/ \ No newline at end of file diff --git a/scripts/sync-vocabulary.sh b/scripts/sync-vocabulary.sh new file mode 100755 index 00000000..2b54655f --- /dev/null +++ b/scripts/sync-vocabulary.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Sync vocabulary data from GCS into validator/vocabulary. +# Requires: gcloud CLI installed and authenticated with access to the bucket. +# +# Usage: +# ./scripts/sync-vocabulary.sh +# +# First-time auth (if needed): +# gcloud auth login + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +VOCAB_DIR="$REPO_ROOT/validator/vocabulary" +GCS_VOCAB="gs://health-bridge-st-ccda-validator-vocabulary/vocabulary" + +echo "Ensuring gcloud is authenticated..." +if ! gcloud auth print-access-token &>/dev/null; then + echo "Run: gcloud auth login" + exit 1 +fi + +echo "Creating local directory: $VOCAB_DIR" +mkdir -p "$VOCAB_DIR" + +echo "Syncing from $GCS_VOCAB to $VOCAB_DIR ..." +gsutil -m rsync -r "$GCS_VOCAB" "$VOCAB_DIR" + +echo "Done. Vocabulary is in validator/vocabulary (ignored by .gitignore)."