| #!/usr/bin/env bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| set -euo pipefail |
|
|
| CASE_NAME="${1:?Usage: $0 <case_name> [seed]}" |
| SEED="${2:-3923}" |
|
|
| REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| OUT_DIR="${REPO_ROOT}/data/cases/${CASE_NAME}" |
| WORK_DIR="${OUT_DIR}/synthea-output" |
| JAR_URL="https://github.com/synthetichealth/synthea/releases/download/v3.3.0/synthea-with-dependencies.jar" |
|
|
| mkdir -p "${WORK_DIR}" |
| cd "${WORK_DIR}" |
|
|
| if [ ! -f synthea-with-dependencies.jar ]; then |
| echo "Downloading Synthea jar..." |
| curl -fL -o synthea-with-dependencies.jar "${JAR_URL}" |
| fi |
|
|
| echo "Generating patient with seed ${SEED}..." |
| java -jar synthea-with-dependencies.jar \ |
| -p 1 -s "${SEED}" \ |
| --exporter.fhir.export=true \ |
| --exporter.csv.export=false \ |
| --generate.only_alive_patients=true \ |
| --exporter.years_of_history=10 \ |
| Massachusetts \ |
| -a 60-75 -g F |
|
|
| |
| PATIENT_BUNDLE="$(ls output/fhir/*.json | grep -v 'hospitalInformation\|practitionerInformation' | head -1)" |
| if [ -z "${PATIENT_BUNDLE}" ]; then |
| echo "ERROR: no patient bundle produced. Check Synthea output above." >&2 |
| exit 1 |
| fi |
|
|
| cp "${PATIENT_BUNDLE}" "${OUT_DIR}/fhir.json" |
| echo "Wrote ${OUT_DIR}/fhir.json" |
|
|