Beispiel #1
0
def hello_monkey():
  body = request.values.get('Body', None)
  result = body.replace(' ',',').split(',')
  if( len(result) > 1 ):
    location = helpers.get_code_for_country(result[0])
    symptoms = []
    for i in range(1, len(result)):
      symptoms.append(helpers.get_highst_score_symptom(result[i]))
    symptoms = list(set(symptoms))
    diseases = symptomelimination.calculate_probability_for_disease(location,symptoms)
    for disease in diseases:
      print helpers.get_name_for_disease(disease['disease']), disease['probability']
    diseases = sorted(diseases, cmp=lambda x, y: cmp(y['probability'],x['probability']))
    message = "We have determined there is a high probability you have {0}".format(helpers.get_name_for_disease(diseases[0]['disease']))
  else:
    number = helpers.get_phone_for_country(helpers.get_code_for_country(body))
    message = "Your emergency number is: " + number
  resp = twilio.twiml.Response()
  resp.sms(message)
  return str(resp)
Beispiel #2
0
def transcription_cb():
  print "Looking up location"
  print str(request.args.get('location'))
  location = helpers.get_code_for_country(str(request.values.get('location')))
  call_id = request.values.get('CallSid')
  print location, call_id
  user_session = {
    "location": location,
    "symptom_whitelist": [],
    "symptom_blacklist": [],
    "question_count": 0
  }
  set_session(redis, call_id, user_session)
  sleep(2)
  member = Tclient.members('').dequeue("http://teledoc.herokuapp.com/location_check", call_id, method="POST")
  return ""