Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Medical-Smart-Chatbot/Medical_chatbot[demo].py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
38 lines (27 sloc)
1.24 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Initial chatbot framework without friendly user interaction;Only direct questions and answers | |
import urllib | |
import json | |
import requests | |
"""Function to start conversation with user""" | |
def chatter(): | |
x=0 | |
print("Hi, I'm a hospital chatbot and I want to help and chat with you ! ") | |
print('To start a conversation with me select an option from below list:') | |
while(x!='/n'): #placeholder for looping | |
print("please select any one among the following :") | |
x=input('1) Accidental drug related death data \n2) Hospitals registered under Medicare \n3) Overall Covid-19 Report \n4) Country-wise Corvid-19 report\n') | |
if x=='1': | |
r= urllib.request.urlopen('http://apps.who.int/gho/athena/api/GHO/WHOSIS_000001.json#?filter=COUNTRY:BWA;YEAR:2011;SEX:BTSX') | |
print(r.read()) | |
if x=='2': | |
r= urllib.request.urlopen('https://data.medicare.gov/api/views/84jm-wiui/rows.json') | |
print(r.read()) | |
if x=='3': | |
r= urllib.request.urlopen('https://coronavirus-19-api.herokuapp.com/all') #from github | |
print(r.read()) | |
if x=='4': | |
r= urllib.request.urlopen('https://coronavirus-19-api.herokuapp.com/countries') #from github | |
print(r.read()) | |
if x=='exit' or x=='Exit': | |
return | |
chatter() |