Last active
March 2, 2023 08:54
-
-
Save hazho/951a7c1afce50785798077e4c332b76e to your computer and use it in GitHub Desktop.
questions to clarify the requirements
This file contains hidden or 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
# at Line Number 42, replace by this code until Line: 77 that contains (# Create a URL route in our application for "/") | |
# Create a URL route in our application for "/fill_json" | |
@app.route('/fill_json', methods=['GET', 'POST']) | |
def fill_available_data_types(): | |
if request.method == 'POST': | |
json_data = request.json | |
print(json_data) | |
cleaned_data_types = [] | |
our_accepted_list_of_data_type = ["ECG", "Floorplan", "Doorcode", "Rescue card", "DAR", "Video", "Audio"] | |
available_data = json_data["available_data_types"] | |
if type(available_data) == list: | |
print("it is list") | |
for data_type in available_data: | |
if data_type in our_accepted_list_of_data_type: | |
cleaned_data_types.append(data_type) | |
else: | |
return {"message": f"the {data_type} is not among the acceptable data types, please reconfirm you entered the data types that are corresponding to any of ({our_accepted_list_of_data_type})."} | |
print(cleaned_data_types) | |
with open("datatypes.json", "w") as json_file: json_file.write(str(cleaned_data_types)) | |
return {"message": "available_data_types had been posted", "available_data_types are": cleaned_data_types} | |
elif type(available_data) == dict: | |
print("it is Dict") | |
for data_type in available_data.keys(): | |
if data_type in our_accepted_list_of_data_type: | |
cleaned_data_types.append(data_type) | |
else: | |
return {"message": f"the {data_type} is not among the acceptable data types, please reconfirm you entered the data types that are corresponding to any of ({our_accepted_list_of_data_type})."} | |
print(cleaned_data_types) | |
with open("datatypes.json", "w") as json_file: json_file.write(str(cleaned_data_types)) | |
return {"message": "available_data_types had been posted", "available_data_types are": cleaned_data_types} | |
elif type(available_data) == str: | |
return {"message": type(available_data)} | |
else: | |
return {"message": f"the information you sent are not in a form that accepted {type(available_data)} is not of (string, list/array and/or dictionary/object) please reconfirm you entered the data correctly."} | |
if request.method == 'GET': | |
return {"message": "this is get only"} |
This file contains hidden or 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
{ | |
"Provided_Information": | |
{ | |
"ecg": true, | |
"floorplan": true, | |
"video": true, | |
"dar": true, | |
"doorcode": false, | |
"audio_stream": false, | |
"recue_sheet": true, | |
"crypto_data": false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
in file templates/home.html
<textarea name="data_types" id="" cols="100" > </textarea>