def handleShowDiagnosisIntent(): patientId = getPatientIdFromUser(session.user.userId) diagnosis = getDiagnosis(patientId) diagnose = diagnosis[len(diagnosis) - 1] return statement( "The latest diagnosis from your doctor was created on " + datetime.utcfromtimestamp(diagnose["timestamp"]).strftime( '%Y-%m-%d %H:%M:%S') + ". The doctor said: " + str(diagnose["diagnosis"]))
def getPatientData(patientId): patientInfo = getPatientInfo(patientId) images = getImageList(patientId) diagnosis = getDiagnosis(patientId) outputData = { "id": patientInfo["patientId"], "images": list(map(lambda x: getImageLink(x["s3Key"], x["s3Bucket"]), images)), "diagnosis": list(map(fixDecimal, diagnosis)) } for key, val in patientInfo.items(): outputData[key] = val return outputData
def getInfo(patientId): if patientId == None: return json.dumps({}) patientInfo = getPatientInfo(patientId) images = getImageList(patientId) diagnosis = getDiagnosis(patientId) result = { "id": patientInfo["patientId"], "familyName": patientInfo["familyName"], "givenName": patientInfo["givenName"], "images": list(map(lambda x: getImageLink(x["s3Key"], x["s3Bucket"]), images)), "diagnosis": list(map(fixDecimal, diagnosis)) } for key, val in patientInfo.items(): result[key] = val return json.dumps(result)