def show_patient(patient_id): "show patient with given patient_id" rq = query_db('select date_created, gender, xray, double_density, \ oblique_diameter, appendage_shape, xray_outcome, ctmri from patients \ where patient_id = %s;', [patient_id], one=True) patient = None if rq: ddate = getDateStr(rq[0]) gender = rq[1] xray = int2bool(rq[2]) ddensity = int2choice(rq[3]) oblique_diam = float(rq[4]) app_shape = appendage2choice(rq[5]) xray_outcome = rq[6] ctmri = int2bool(rq[7]) patient = dict(patient_id=patient_id, datetime=ddate, gender=gender, xray=xray, double_density=ddensity, oblique_diameter=oblique_diam, appendage_shape=app_shape, xray_outcome=xray_outcome, ctmri=ctmri) return render_template('show_patient.html', patient=patient)
def test_int2choice(self): self.assertEqual('True', int2choice(2)) self.assertEqual('False', int2choice(0)) self.assertEqual('Unsure', int2choice(1)) self.assertEqual('Unsure', int2choice(-1))