forked from synthetichealth/synthea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_files
executable file
·63 lines (49 loc) · 1.87 KB
/
upload_files
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
BATCH_SIZE=100
COUNT=0
# Upload all the hospital files first
# then upload the practitioner files
# then upload the patient files
# hospital file names start with hospitalInformation*
# practitioner file names start with practitionerInformation*
# all the rest of the files are patient files
for file in output/fhir/hospitalInformation*.json; do
curl -X POST -H "Content-Type: application/fhir+json" \
--data-binary @"$file" https://hapifhir.bravesea-ed301486.eastus.azurecontainerapps.io/fhir
COUNT=$((COUNT + 1))
echo -n "."
# Pause after every 100 uploads to avoid overwhelming the server
if (( COUNT % BATCH_SIZE == 0 )); then
echo "Uploaded $COUNT files. Pausing for 5 seconds..."
sleep 5
fi
done
echo -e "\nHospital Information Files Uploaded!"
for file in output/fhir/practitionerInformation*.json; do
curl -X POST -H "Content-Type: application/fhir+json" \
--data-binary @"$file" https://hapifhir.bravesea-ed301486.eastus.azurecontainerapps.io/fhir
COUNT=$((COUNT + 1))
echo -n "."
# Pause after every 100 uploads to avoid overwhelming the server
if (( COUNT % BATCH_SIZE == 0 )); then
echo "Uploaded $COUNT files. Pausing for 5 seconds..."
sleep 5
fi
done
echo -e "\nPractitioner Information Files Uploaded!"
for file in output/fhir/*.json; do
# Skip already-uploaded hospital and practitioner files
if [[ $file == *hospitalInformation* || $file == *practitionerInformation* ]]; then
continue
fi
curl -X POST -H "Content-Type: application/fhir+json" \
--data-binary @"$file" https://hapifhir.bravesea-ed301486.eastus.azurecontainerapps.io/fhir
COUNT=$((COUNT + 1))
echo -n "."
# Pause after every 100 uploads to avoid overwhelming the server
if (( COUNT % BATCH_SIZE == 0 )); then
echo "Uploaded $COUNT files. Pausing for 5 seconds..."
sleep 5
fi
done
echo "All files uploaded!"