Created
June 15, 2020 00:08
-
-
Save rajvansia/a73812dc902c84a15959025ebfdb7b72 to your computer and use it in GitHub Desktop.
This file contains 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
import json | |
import os | |
import requests | |
#fhir server endpoint | |
URL = "http://localhost:8080/hapi-fhir-jpaserver/fhir/" | |
#fhir server json header content | |
headers = {"Content-Type": "application/fhir+json;charset=utf-8"} | |
#loop over all files in the output folder in order to upload each json file for each patient. | |
for dirpath, dirnames, files in os.walk('/Users/rajvansia/Documents/GitHub/synthea/output/fhir'): | |
for file_name in files: | |
with open('/Users/rajvansia/Documents/GitHub/synthea/output/fhir/'+file_name, "r") as bundle_file: | |
data = bundle_file.read() | |
r = requests.post(url = URL, data = data, headers = headers) | |
#output file name that was processed | |
print(file_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks. This saved my day!