Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4a0844f

Browse files
committedNov 7, 2019
Update initialize file for usage with async FHIRClient
1 parent 6470533 commit 4a0844f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎initialize.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@
44
import os.path
55

66

7-
def import_bundle(client, filename):
7+
async def import_bundle(client, filename):
88
with open(filename) as fd:
99
patient_json = json.load(fd)
1010
bundle = client.resource('Bundle')
1111
bundle['type'] = 'transaction'
12-
bundle._get_path = lambda: ''
1312
bundle['entry'] = patient_json['entry']
14-
bundle.save()
13+
await bundle.save()
1514

1615

17-
def import_dataset(client, dataset_path):
16+
async def import_dataset(client, dataset_path):
1817
sys.stdout.write("Import progress: 0% \r")
1918

2019
filenames = [
@@ -23,10 +22,9 @@ def import_dataset(client, dataset_path):
2322

2423
total_count = len(filenames)
2524
for index, filename in enumerate(filenames):
26-
import_bundle(client, os.path.join(dataset_path, filename))
25+
await import_bundle(client, os.path.join(dataset_path, filename))
2726
progress = int(float(index + 1) / float(total_count) * 100)
2827
sys.stdout.write("Import progress: %d%% \r" % progress)
2928
sys.stdout.flush()
3029
sys.stdout.write("Import progress: 100%\n")
3130
sys.stdout.write("{0} bundles imported".format(total_count))
32-

0 commit comments

Comments
 (0)
Please sign in to comment.