Careflight Data
careflight_data.py
#live API URL: https://digisoln.com/careflight/ careflight = { "hospitals": { #current patient numbers generated randomly, 25% hospital is full: "Cairns": {"capacity": 531, "current": -1, "grid_location": "H8"}, "Townsville": {"capacity": 775, "current": -1, "grid_location": "I11"}, "Rockhampton": {"capacity": 300, "current": -1, "grid_location": "M15"}, "Mackay": {"capacity": 236, "current": -1, "grid_location": "L13"}, "Brisbane": {"capacity": 1000, "current": -1, "grid_location": "O19"} }, "map_url": "https://digisoln.com/assessments/queensland_hospitals_map.png", "triage_url": "https://www.qld.gov.au/health/services/emergency", "triage_ratings": { 1: "immediately life threatening patients: critical injury or cardiac arrest", 2: "imminently life threatening patients: critical illness, very severe pain, have serious chest pains, difficulty in breathing or severe fractures", 3: "potentially life threatened patients: severe illness, bleeding heavily from cuts, have major fractures, dehydrated", 4: "potentially serious patients: less severe symptoms or injuries, such as foreign body in the eye, sprained ankle, migraine or ear ache", 5: "less urgent patients: minor illnesses or symptoms, rashes, minor aches and pains" }, "helicopter_status_types": { "awaiting": "ready for dispatch", "responding": "enroute to a request", "returning": "carrying patients back to a hospital" }, "helicopter_status": { "helicopter1": { "current_grid_location": "I11", "allocated_request": "", "target_grid_location": "I11", "status": "awaiting", "current_patients_on_board": 0 }, "helicopter2": { "current_grid_location": "O19", "allocated_request": "request2", "target_grid_location": "K17", "status": "responding", "current_patients_on_board": 3 } }, "help_requests": { "request1": { "desc": "car accident", "number_requiring_help": 3, "grid_location": "F10", "triage_rating": 3 }, "request2": { "desc": "brown snake bite", "patients_requiring_help": 1, "grid_location": "K17", "triage_rating": 1 }, "request3": { "desc": "fell off skateboard", "patients_requiring_help": 1, "grid_location": "B13", "triage_rating": 5 } } } def regenerate_current_patient_numbers(): import random global careflight for location in careflight["hospitals"]: temp_capacity = careflight["hospitals"][location]["capacity"] chance_of_full = 0.25 #25% hospital is full fill = random.randint(0, int(temp_capacity+(temp_capacity*chance_of_full))) if fill > temp_capacity: fill = temp_capacity careflight["hospitals"][location]["current"] = fill regenerate_current_patient_numbers() ######## TO LOOKUP API: ######## # #https://digisoln.com/careflight/hospitals/Rockhampton/ #OR: print(careflight["hospitals"]["Rockhampton"]) #https://digisoln.com/careflight/helicopter_status/helicopter2/status/ #OR: print(careflight["helicopter_status"]["helicopter2"]["status"])