-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertInterface.py
More file actions
69 lines (64 loc) · 2.48 KB
/
insertInterface.py
File metadata and controls
69 lines (64 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import lambda_function
import json
userChoice = 0
while userChoice != 5:
userChoice = int(input("What would you like to insert to the database?\n1. State\n2. County\n3. Pollutant Site\n4. Pollutant Sample\n5. Quit\n"))
if userChoice < 5 and userChoice > 0:
if userChoice == 1:
stateName = input("Please input a state name: ")
passedJson = {
"queryType": "insertState",
"parameters": {
"state": stateName,
}
}
elif userChoice == 2:
countyName = input("Please input a county name: ")
passedJson = {
"queryType": "insertCounty",
"parameters": {
"county": countyName,
}
}
elif userChoice == 3:
countyName = input("Please input a county name: ")
stateName = input("Please input a state name: ")
address = input("Please input an address: ")
city = input("Please input a city: ")
passedJson = {
"queryType": "insertSite",
"parameters": {
"county": countyName,
"state": stateName,
"address": address,
"city": city
}
}
else:
pollutantName = input("What pollutant is it?: ")
address = input("Please input the address: ")
maxHour = input("At what point what the pollutant most concentrated?: ")
date = input("What date is this sample?: ")
maxValue = input("What is the max concentration reached?: ")
aqi = input("Please input the aqi: ")
units = input("Please input the units of measurement: ")
mean = input("Please input the mean concentration: ")
passedJson = {
"queryType": "insertPollutantSample",
"parameters": {
"pollutant": pollutantName,
"address": address,
"maxhour": maxHour,
"date": date,
"maxvalue": maxValue,
"aqi": aqi,
"units": units,
"mean": mean
}
}
body = {
'body': json.dumps(passedJson)
}
print(lambda_function.lambda_handler(body, None)['body'])
elif userChoice != 5:
print("Invalid Option!")