<jupyter_start><jupyter_text>World Health Organization Data Global Health Observatory* [Data query API](https://apps.who.int/gho/data/node.resources.api)* [GHO OData API ](https://www.who.int/data/gho/info/gho-odata-api)Para se determinar o tipo de informação para acesso veja a [lista de dimensões e códigos](https://apps.who.int/gho/athena/api/GHO). Utilize o código disponível no campo ``. Por exemplo, no campo `` é possível encontrar o código `WHOSIS_000001` que indica `Life expectancy at birth (years)`.Depois de estabelecida a informação, podem ser configurados parâmetros, com o sufixo `?` depois da URL. Os parâmetros são separados por `?`.Os códigos dos países são encontrados em: [https://apps.who.int/gho/athena/api/COUNTRY](https://apps.who.int/gho/athena/api/COUNTRY).  Importando dados em JSON no Python![JSON](json.png)<jupyter_code>import io
import requests
import json
url = "https://apps.who.int/gho/athena/api/GHO/WHOSIS_000001?filter=COUNTRY:BRA&format=json"
js = json.loads(requests.get(url).content)
print(js["copyright"])<jupyter_output>(c) World Health Organization<jupyter_text>Importando dados em CSV no Python![CSV](csv.png)<jupyter_code>import pandas as pd
import io
import requests
url = "https://apps.who.int/gho/athena/api/GHO/WHOSIS_000001?filter=COUNTRY:BRA&format=csv"
data = requests.get(url).content
csv = pd.read_csv(io.StringIO(data.decode("utf-8")))
print(csv)<jupyter_output><empty_output><jupyter_text>Importando dados em XML no Python![XML](xml.png)<jupyter_code>import io
import requests
import xml.etree.ElementTree as et
url = "https://apps.who.int/gho/athena/api/GHO/WHOSIS_000001?filter=COUNTRY:BRA"
data = requests.get(url).content
x = et.parse(io.StringIO(data.decode("utf-8")))
print(x)<jupyter_output><xml.etree.ElementTree.ElementTree object at 0x7fb2cf85c1d0><jupyter_text>Tarefa 1Das fontes de dados disponíveis, tente encontrar fontes com formatos diferentes e importá-las via Python. Busque pelo menos dois formatos.<jupyter_code>import requests
import io
import pandas as pd
url = 'https://dashboard.healthit.gov/api/open-api.php?source=AHA_2008-2015.csv&region=Maryland&period=2015&format=csv'
data = requests.get(url).content
csv = pd.read_csv(io.StringIO(data.decode("utf-8")))
print(csv)
import json
import requests
url = 'https://dashboard.healthit.gov/api/open-api.php?source=AHA_2008-2015.csv&region=Maryland&period=2015&format=json'
js = json.loads(requests.get(url).content)
print(js)<jupyter_output>{'21': {'region': 'Maryland', 'region_code': 'MD', 'period': '2015', 'pct_hospitals_basic_ehr_notes': '0.95', 'pct_rural_hospitals_basic_ehr_notes': '1', 'pct_small_hospitals_basic_ehr_notes': '1', 'pct_critical_access_hospitals_basic_ehr_notes': '', 'pct_hospitals_basic_ehr_no_notes': '1', 'pct_rural_hospitals_basic_ehr_no_notes': '1', 'pct_small_hospitals_basic_ehr_no_notes': '1', 'pct_critical_access_hospitals_basic_ehr_no_notes': '', 'pct_hospitals_cehrt': '1', 'pct_small_rural_hospitals_cehrt': '1', 'pct_cah_hospitals_cehrt': '', 'pct_hospitals_share_labs_any_outside_provs': '0.736076684', 'pct_hospitals_share_labs_any_outside_hospitals': '0.479798295', 'pct_hospitals_share_labs_any_outside_ambu_provs': '0.654745427', 'pct_hospitals_patients_ecopy_ehr': '', 'pct_hospitals_patients_ecopy_discharge_instr': '', 'pct_hospitals_share_care_summaries_any_outside_provs': '0.816704762', 'pct_hospitals_share_care_summaries_any_outside_hospitals': '0.686932567', 'pct_hospitals_share_care_sum[...]
{'fraction_non_alphanumeric': 0.13648142816009215, 'fraction_numerical': 0.03599193780593147, 'mean_word_length': 8.094240837696335, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 10, 'lorem ipsum': 0, 'www.': 1, 'xml': 3}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '158427', 'license': 'MIT', 'n_tokens_mistral': 1442, 'n_tokens_neox': 1347, 'n_words': 220, 'path': 'lab01/notebooks/data-api-python-ra175154.ipynb', 'repo_name': 'natrodrigues/mc536-unicamp', 'size': '3473'}