Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a9c54bfe11 | |||
d5c2d2ca64 |
@ -32,7 +32,10 @@ def getBundle(url: str, search: str):
|
|||||||
|
|
||||||
|
|
||||||
if url is not None:
|
if url is not None:
|
||||||
link = url + '?_format=json'
|
if '?' in url:
|
||||||
|
link = url + '&_format=json'
|
||||||
|
else:
|
||||||
|
link = url + '?_format=json'
|
||||||
else:
|
else:
|
||||||
link = fhir_server + search + '&_format=json'
|
link = fhir_server + search + '&_format=json'
|
||||||
|
|
||||||
|
@ -24,18 +24,21 @@ from fhirImport import getPatientEverything, getBundle
|
|||||||
def load_multiple_fhir_patients(n):
|
def load_multiple_fhir_patients(n):
|
||||||
#graph = nx.DiGraph()
|
#graph = nx.DiGraph()
|
||||||
init = True
|
init = True
|
||||||
|
initLoad = True
|
||||||
ids = []
|
ids = []
|
||||||
#get n ids
|
#get n ids
|
||||||
nextIds = True
|
nextIds = True
|
||||||
while len(ids) < n and nextIds:
|
while len(ids) < n and nextIds:
|
||||||
if init:
|
if initLoad:
|
||||||
complex = os.getenv('COMPLEX_PATIENTS')
|
complex = os.getenv('COMPLEX_PATIENTS')
|
||||||
if complex and complex.upper() != 'TRUE':
|
if complex and complex.upper() != 'TRUE':
|
||||||
bundle = getBundle(None, '/Patient?_count=' + str(n))
|
bundle = getBundle(None, '/Patient?_count=' + str(n))
|
||||||
else:
|
else:
|
||||||
bundle = getBundle(None, '/Patient?_has:Observation:subject:status=final&_count=' + str(n))
|
bundle = getBundle(None, '/Patient?_has:Observation:subject:status=final&_count=' + str(n))
|
||||||
|
initLoad = False
|
||||||
else:
|
else:
|
||||||
bundle = getBundle(None, nextLink)
|
print("NEXT LINK: ", nextLink, flush=True)
|
||||||
|
bundle = getBundle(nextLink, None)
|
||||||
|
|
||||||
if not 'entry' in bundle.json():
|
if not 'entry' in bundle.json():
|
||||||
print("ERROR -- No data found in the fhir bundle. Check the request and if the server is up and responding")
|
print("ERROR -- No data found in the fhir bundle. Check the request and if the server is up and responding")
|
||||||
|
Reference in New Issue
Block a user