{"metadata":{"colab":{"provenance":[],"collapsed_sections":[]},"kernelspec":{"name":"python3","display_name":"Python 3 (ipykernel)","language":"python"},"language_info":{"name":"python","version":"3.9.15","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Uso del API MakeSens","metadata":{"id":"wtWF1n8HOTFV"}},{"cell_type":"markdown","source":"Instalar Librerias","metadata":{"id":"vh3vxnBcOg1s"}},{"cell_type":"code","source":"#!pip install APIMakeSens\n#!pip install tk","metadata":{"id":"2qUuqqUrOist","trusted":true},"execution_count":1,"outputs":[]},{"cell_type":"markdown","source":"Cargar librería *MakeSens*","metadata":{"id":"kqjOySK5OzWd"}},{"cell_type":"code","source":"# Makesens\nfrom MakeSens import MakeSens\n# Pandas \nimport pandas as pd \n# datetime para manejo de fechas\nimport datetime\n# pytz para manejo de zonas horarias\nimport pytz","metadata":{"id":"METaVqUqOPPp","trusted":true},"execution_count":2,"outputs":[]},{"cell_type":"markdown","source":"Definir token y cargar listado de estaciones","metadata":{"id":"RMuW2nnqPFJd"}},{"cell_type":"code","source":"estaciones = pd.read_csv(\"evasLA-CoNGA.csv\").set_index(\"id\")","metadata":{"id":"J8zPR6KYOZPh","trusted":true},"execution_count":12,"outputs":[]},{"cell_type":"markdown","source":"Definir rango de fechas para descarga","metadata":{"id":"AHgUeh7F_-py"}},{"cell_type":"code","source":"fechaFin = datetime.datetime.now(pytz.timezone('America/Bogota')).strftime('%Y-%m-%d %H:%M:%S')\nfechaInicio = (datetime.datetime.now(pytz.timezone('America/Bogota'))-datetime.timedelta(hours=240)).strftime('%Y-%m-%d %H:%M:%S')","metadata":{"id":"LulIK6c9_-GT","trusted":true},"execution_count":14,"outputs":[]},{"cell_type":"code","source":"for eva in estaciones.index:\n data = MakeSens.download_data(eva, fechaInicio, fechaFin, 'h')\n if data.empty:\n print(eva, estaciones.loc[eva]['institucion'], 'Offline')\n else:\n print(eva, estaciones.loc[eva]['institucion'], data['temperatura'][0])","metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"04N3QvHqRcJ2","outputId":"4d37f2df-91c3-4925-8540-deeaffb1ebca","trusted":true},"execution_count":26,"outputs":[{"name":"stdout","text":"E2_00010 Yachay Offline\nE2_00011 UAN Offline\nE2_00012 UIS 26.740791766666668\nE2_00013 UIS Offline\nE2_00014 UCV Offline\nE2_00015 UAN Offline\nE2_00016 USFQ Offline\nE2_00017 UNMSM Offline\nE2_00018 USB 26.138263899999995\nE2_00019 UNI Offline\n","output_type":"stream"}]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}
E2_00013,Offline,UIS,https://makesens.aws.thinger.io/dashboards/DE2_00013?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDEzIiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.dhTGRnuLBRVf8f_whId34_NrhIq8JrBGmetIgKV--A4,Jennifer Grisales,Mattermost,Deconexión de red
E2_00014,Online,UCV,https://makesens.aws.thinger.io/dashboards/DE2_00018?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE4Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.yLS1E47V58-8o-UybfCSOdejYxJfAJmlxFfe6IwhUko,José Antonio López Rodríguez,Mattermost,
E2_00014,Online,USB,https://makesens.aws.thinger.io/dashboards/DE2_00018?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE4Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.yLS1E47V58-8o-UybfCSOdejYxJfAJmlxFfe6IwhUko,José Antonio López Rodríguez,Mattermost,
E2_00015,Offline,UAN,https://makesens.aws.thinger.io/dashboards/DE2_00015?authorization=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJEYXNoYm9hcmRfREUyXzAwMDE1Iiwic3ZyIjoibWFrZXNlbnMuYXdzLnRoaW5nZXIuaW8iLCJ1c3IiOiJNYWtlU2VucyJ9.1yGSWoyP-hi_GJSc2vVakJfJj7gyRgsaKFi99b7rJVc,Yohani Rodriguez,Mattermost,Problema de compatibilidad wifi - estación