-
-
Save rafamayo/1731e489b114a8cb1ac4c3f8fbc6e9fc 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/fhir/" | |
# FHIR server json header content | |
headers = {"Content-Type": "application/fhir+json;charset=utf-8"} | |
# This path is specific to my setup | |
dirTestPatients = '../../Synthea/output/fhir/' | |
# 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(dirTestPatients): | |
for file_name in files: | |
# Make sure the encoding is utf-8 | |
with open(dirTestPatients+file_name, "r", encoding='utf-8') as bundle_file: | |
data = bundle_file.read() | |
r = requests.post(url = URL, data = data, headers = headers) | |
# Output file name that was processed + the status code | |
print(file_name) | |
print(r.status_code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
was this ever fixed, getting same error where it just creates “Location” and “Organization”