def patient_get(request, id): logging.info("entering patient get proc") username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) omrs = openmrs.OpenMRS(username, password, settings.OPENMRS_SERVER_URL) logging.info("About to getPatient") try: patient_xml = omrs.get_patient(id) data = patient.parse_patient_xml(patient_xml) response = json_succeed(data) except Exception, e: logging.error("Got error %s" % e) response = json_fail("couldn't get patient")
def patient_get(request, id): logging.info("entering patient get proc") username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) omrs = openmrs.OpenMRS(username,password, settings.OPENMRS_SERVER_URL) logging.info("About to getPatient") try: patient_xml = omrs.get_patient(id) data = patient.parse_patient_xml(patient_xml) response = json_succeed(data) except Exception, e: logging.error("Got error %s" % e) response = json_fail("couldn't get patient")
def read(self, request, patient_id=None): # Get patient by ID. username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) logging.info("Setting up EMR connection. Username: %s Password: %s" % (username, password)) omrs = openmrs.OpenMRS(username,password, settings.OPENMRS_SERVER_URL) try: if patient_id is None: logging.info("Looking up all patients.") patients_xml = omrs.get_all_patients() logging.info("Got response from EMR: %s" % patients_xml) data = patient.parse_patient_list_xml(patients_xml) else: logging.info("Looking up patient id %s." % patient_id) patient_xml = omrs.get_patient(patient_id) logging.debug("Patient data returned by OpenMRS: %s" % patient_xml) data = patient.parse_patient_xml(patient_xml) response = succeed(data) except Exception, e: logging.error("Got error %s" % e) response = fail("couldn't get patient")
def read(self, request, patient_id=None): # Get patient by ID. username = request.REQUEST.get("username", None) password = request.REQUEST.get("password", None) logging.info("Setting up EMR connection. Username: %s Password: %s" % (username, password)) omrs = openmrs.OpenMRS(username, password, settings.OPENMRS_SERVER_URL) try: if patient_id is None: logging.info("Looking up all patients.") patients_xml = omrs.get_all_patients() logging.info("Got response from EMR: %s" % patients_xml) data = patient.parse_patient_list_xml(patients_xml) else: logging.info("Looking up patient id %s." % patient_id) patient_xml = omrs.get_patient(patient_id) logging.debug("Patient data returned by OpenMRS: %s" % patient_xml) data = patient.parse_patient_xml(patient_xml) response = succeed(data) except Exception, e: logging.error("Got error %s" % e) response = fail("couldn't get patient")