def index(): client = FHIRClient(state=session['client_state'], secret=settings['secret']) patient = client.Patient() prescriptions = client.MedicationPrescription() out = """<!DOCTYPE html> <html> <head><title>Sample REST App</title></head> <body> """ h = ' '.join((patient['name'][0]['given'][0], patient['name'][0]['family'][0], patient['birthDate'])) out += "<h1>Medications for <span id='name'>%s</span></h1>\n" % h out += "<ul id='med_list'>\n" # medication may only be present as a reference in the prescription -> in a complete implementation # would need to implement a more flexible/adaptive mechanism for retrieval for prescription in prescriptions: meds = prescription['contained'] for med in meds: out += "<li>%s</li>" % med['name'] out += """ </ul> </body> </html>""" return out