Created
March 18, 2022 10:21
-
-
Save Aitem/10d3b40de67771ecc136be860abfa316 to your computer and use it in GitHub Desktop.
Synthea generate 1M Patient and S3 upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SYNTHEA_JAR="./synthea.jar" | |
BUNDLE_COUNT=40 | |
BUNDLE_SIZE=25000 | |
OUTPUT_PREFIX=/tmp/synthea | |
BUCKET=how-to-load | |
for i in $(seq $BUNDLE_COUNT) | |
do | |
DISK_USAGE_STAT_PATH="/tmp/stat-$i" | |
AWS_BUCKET_STAT_PATH="s3://$BUCKET/stat/" | |
AWS_BUCKET_DATA_PATH="s3://$BUCKET/fhir/$i" | |
java -jar $SYNTHEA_JAR -p $BUNDLE_SIZE --exporter.fhir.bulk_data=true -s $i -cs $i --exporter.baseDirectory="$OUTPUT_PREFIX/$i" | grep -F 'Records: ' | |
du -a -d 1 -h "$OUTPUT_PREFIX/$i/fhir" | sort -hr > "$DISK_USAGE_STAT_PATH" | |
du -a -d 1 -h "$OUTPUT_PREFIX/$i/fhir" | sort -hr | |
pigz -fr "$OUTPUT_PREFIX/$i/fhir/" > /dev/null | |
aws s3 rm "$AWS_BUCKET_DATA_PATH" --recursive > /dev/null | |
aws s3 mv "$OUTPUT_PREFIX/$i/fhir" "$AWS_BUCKET_DATA_PATH" --recursive > /dev/null | |
aws s3 cp "$DISK_USAGE_STAT_PATH" "$AWS_BUCKET_STAT_PATH" > /dev/null | |
rm "$DISK_USAGE_STAT_PATH" > /dev/null | |
rm -rf "${OUTPUT_PREFIX:?}/$i" > /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment