Files
medax_pipeline/entrypoint.sh
T
2026-09-08 10:59:05 +02:00

51 lines
1.4 KiB
Bash

#!/bin/bash
set -euo pipefail
if [ "${DISABLE_IMPORT:-false}" = "true" ]; then
echo "DISABLE_IMPORT is true - skipping ETL pipeline to only up the GDB"
exit 0
fi
# Wait for a file to appear, with a timeout so the container can't hang forever.
# Usage: wait_for_file <path> [timeout_seconds]
wait_for_file() {
local file="$1"
local timeout="${2:-300}"
local waited=0
while [ ! -f "$file" ]; do
if [ "$waited" -ge "$timeout" ]; then
echo "Timed out after ${timeout}s waiting for $(basename "$file")" >&2
exit 1
fi
echo "Waiting for $(basename "$file")..."
sleep 5
waited=$((waited + 5))
done
}
# Make the import dir accessible to both the Python app and Neo4j
chmod -R 777 /neo4j_import
#echo "Waiting for Neo4j to be ready..."
#python wait-for-neo4j.py
echo "Running Python data processing script..."
#python import_fhir_to_nx_diGraph.py
python multiple_adapters.py
echo "Running Neo4j import..."
# Give downstream services a moment before touching the database
sleep 5
# Wait for the shell script to finish writing its data
wait_for_file /neo4j_import/shell-scipt-complete
# Signal that data is prepared and ready to import
touch /neo4j_import/ready-to-import
chmod 777 /neo4j_import/ready-to-import
# Wait for the import to complete
echo "Waiting for Neo4j import to complete..."
wait_for_file /neo4j_import/import-complete
echo "Database setup complete!"