amazonasdatahub 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ # read version from installed package
2
+ from importlib.metadata import version
3
+ __version__ = version("amazonasdatahub")
@@ -0,0 +1,36 @@
1
+ import pandas as pd
2
+ import requests
3
+ from pathlib import Path
4
+
5
+ CACHE_DIR = Path.home() / ".cache" / "amazonasdatahub"
6
+ CACHE_DIR.mkdir(parents = True, exist_ok=True)
7
+
8
+ def get_dataset(dataset_name, force=False):
9
+ """
10
+ Gather an specific dataset.
11
+ :param dataset_name: Dataset name (example: agriculture_amazonas)
12
+ :param force: If True, ignores the cache and downloads the dataset again
13
+ """
14
+
15
+ file_name = f"{dataset_name}.parquet"
16
+ local_path = CACHE_DIR / file_name
17
+ url = f"https://github.com/onelsoncarvalho/amazonasdatahubpy/raw/refs/heads/main/raw_data/{file_name}"
18
+
19
+ if force or not local_path.exists():
20
+ print(f"Gathering updated data from {url}...")
21
+ try:
22
+ response = requests.get(url)
23
+ response.raise_for_status()
24
+
25
+ with open(local_path, "wb") as f:
26
+ f.write(response.content)
27
+ print(f"Saved in: {local_path}")
28
+
29
+ except Exception as e:
30
+ if not local_path.exists():
31
+ raise Exception(f"Error while downloading and there is no cache available: {e}")
32
+ print(f"Warning: Download error, using old cache version. Error: {e}")
33
+
34
+ return pd.read_parquet(local_path)
35
+
36
+
@@ -0,0 +1,33 @@
1
+ import frontmatter
2
+ from importlib import resources
3
+
4
+
5
+ def get_doc(dataset_name):
6
+ """
7
+ Shows the documentation of a dataset
8
+ """
9
+
10
+ try:
11
+ md_path = resources.files("amazonasdatahub.documentations").joinpath(f"{dataset_name}.md")
12
+ if not md_path.exists():
13
+ print(f"Docs for {dataset_name} not found")
14
+ return
15
+
16
+ md_content = md_path.read_text(encoding = "utf-8")
17
+
18
+ loaded_md = frontmatter.loads(md_content)
19
+
20
+ title = loaded_md.get('title', dataset_name.upper())
21
+ body = loaded_md.content
22
+
23
+ print(f"\n{'='*60}")
24
+ print(f"Documentation from: {title}")
25
+ print(f"{'='*60}")
26
+
27
+ try :
28
+ from IPython.display import display, Markdown
29
+ display(Markdown(body))
30
+ except ImportError:
31
+ print(body)
32
+ except Exception as e:
33
+ print(f"Error while processing docs: {e}")
@@ -0,0 +1,109 @@
1
+ ---
2
+ title: "agriculture_amazonas"
3
+ ---
4
+
5
+ # agriculture_amazonas
6
+
7
+ Plant production data from the Institute of Sustainable Agricultural and Forestry Development of Amazonas - IDAM (2023).
8
+
9
+ ### Description
10
+
11
+ This database, which is the consolidation of data from IDAM's activity reports, provides crop production data for crops that this institute considers a priority.
12
+
13
+ ### Usage
14
+
15
+ ```python
16
+ agriculture_amazonas = get_dataset("agriculture_amazonas")
17
+ ```
18
+
19
+ ### Format
20
+
21
+ ‘agriculture_amazonas’ A data frame with 1072 rows and 13 columns:
22
+
23
+ #### municipality
24
+
25
+ Municipality
26
+
27
+ #### local_unit
28
+
29
+ Local Unit of the Institute
30
+
31
+ #### n_beneficiary
32
+
33
+ Number of assisted beneficiaries
34
+
35
+ #### planted
36
+
37
+ Planted area in hectares (ha)
38
+
39
+ #### harvested
40
+
41
+ Harvested area in hectares (ha)
42
+
43
+ #### production
44
+
45
+ Production (in the unit of measurement - measure)
46
+
47
+ #### estimated_n_beneficiary
48
+
49
+ Estimate of the number of beneficiaries
50
+
51
+ #### estimated_planted
52
+
53
+ Estimate of the planted area (ha)
54
+
55
+ #### estimated_harvested
56
+
57
+ Estimate of the harvested area (ha)
58
+
59
+ #### estimated_production
60
+
61
+ Estimate of production (in the unit of measurement - measure)
62
+
63
+ #### measure
64
+
65
+ Unit of Measurement of production
66
+
67
+
68
+ #### cultivation
69
+
70
+ Cultivation
71
+
72
+ #### year
73
+
74
+ Year of cultivation
75
+
76
+ ### Source
77
+
78
+ https://www.idam.am.gov.br/biblioteca/relatorio-de-atividades-rat-23-2/
79
+
80
+
81
+ ### Example
82
+
83
+ ```python
84
+ import matplotlib.pyplot as plt
85
+ from amazonasdatahub.datasets import get_dataset
86
+
87
+ # Loading data
88
+ agriculture_amazonas = get_dataset("agriculture_amazonas")
89
+
90
+ # Filtering data
91
+ mandioca_prod = agriculture_amazonas[
92
+ agriculture_amazonas["cultivation"] == "Mandioca"
93
+ ]
94
+
95
+ # Scatterplot
96
+ plt.figure(figsize=(8,6))
97
+ plt.scatter(
98
+ mandioca_prod["planted"],
99
+ mandioca_prod["harvested"],
100
+ alpha=0.7,
101
+ edgecolors="none"
102
+ )
103
+ plt.xlabel("Planted area (hectare)")
104
+ plt.ylabel("Harvested area (hectare)")
105
+ plt.title("Cassava production in Amazonas")
106
+ plt.grid(True, linestyle="--", alpha=0.5)
107
+ plt.tight_layout()
108
+ plt.show()
109
+ ```
@@ -0,0 +1,75 @@
1
+ ---
2
+ title: "aids_amazonas"
3
+ ---
4
+
5
+
6
+ # aids_amazonas
7
+
8
+ A dataset of AIDS occurrences from 2011 to 2023 in Amazonas
9
+
10
+ ### Description
11
+
12
+ This dataset contains data of the AIDS occurrences in each municipality from Amazonas.
13
+
14
+ ### Usage
15
+
16
+ ```python
17
+ aids_amazonas = get_dataset("aids_amazonas")
18
+ ```
19
+
20
+ ### Format
21
+
22
+ ‘aids_amazonas’ A data frame with 48 rows and 21 columns:
23
+
24
+ #### code_muni
25
+
26
+ Municipality code
27
+
28
+ #### name_muni
29
+
30
+ Municipality name
31
+
32
+ #### cases
33
+
34
+ Case count
35
+
36
+ #### gender
37
+
38
+ Gender of the infected individual - M for Male and F for female
39
+
40
+ #### year
41
+
42
+ Year of observation
43
+
44
+ ### Source
45
+
46
+ https://indicadores.aids.gov.br
47
+
48
+
49
+ ### Example
50
+
51
+ ```python
52
+ import matplotlib.pyplot as plt
53
+ from amazonasdatahub.datasets import get_dataset
54
+
55
+ # Load dataset
56
+ aids_amazonas = get_dataset("aids_amazonas")
57
+
58
+ # Filter by municipality and pivot data by gender
59
+ manaus_aids = aids_amazonas[aids_amazonas["name_muni"] == "Manaus"]
60
+ pivot_aids = manaus_aids.pivot(
61
+ index="year", columns="gender", values="cases"
62
+ )
63
+
64
+ # Plot line chart
65
+ pivot_aids.plot(marker="o", figsize=(9, 5))
66
+
67
+ # Titles, labels and custom configurations
68
+ plt.title("AIDS occurrences in Manaus (2011-2023)")
69
+ plt.xlabel("Year")
70
+ plt.ylabel("Case count")
71
+ plt.legend(title="Gender")
72
+ plt.grid(True, linestyle="--", alpha=0.5)
73
+ plt.tight_layout()
74
+ plt.show()
75
+ ```
@@ -0,0 +1,144 @@
1
+ ---
2
+ title: "gdp_amazonas"
3
+ ---
4
+
5
+ # gdp_amazonas
6
+
7
+ Gross Domestic Product - GDP of Amazonas
8
+
9
+ ### Description
10
+
11
+ This database contains information about the Gross Domestic Product (GDP) of the state of Amazonas over the years (from 2010 to 2021). It includes values in R$ 1,000,000.
12
+
13
+
14
+ ### Usage
15
+
16
+ ```python
17
+ gdp_amazonas = get_dataset("gdp_amazonas")
18
+ ```
19
+
20
+ ### Format
21
+
22
+ ‘gdp_amazonas’ A data frame with 48 rows and 21 columns:
23
+
24
+ #### year
25
+
26
+ Indicates the year in which the GDP info was collected
27
+
28
+ #### quarter
29
+
30
+ Specifies the quarter of the year
31
+
32
+ #### agriculture
33
+
34
+ Refers to the economic output from agricultural activities, including cultivation, harvesting, and logistical support after harvest
35
+
36
+ #### livestock
37
+
38
+ Represents the economic contribution from livestock farming, covering meat, dairy production, and related support services
39
+
40
+ #### forest_fishing_prod
41
+
42
+ Outputs from forestry (timber and non-timber products), fishing activities and aquaculture (fish farming)
43
+
44
+ #### extractive_ind
45
+
46
+ Extractive industries of natural resources as minearls and oil
47
+
48
+ #### manufacturing_ind
49
+
50
+ Refers to the transformation of raw materials into finished goods industries
51
+
52
+ #### basic_infrastructure
53
+
54
+ Encompasses services related to electricity and gas generation, water supply, sewage treatment, and waste management.constructionRepresents economic activities related to building construction.
55
+
56
+ #### vehicle_retail_repair
57
+
58
+ Includes all commercial activities related to selling goods and services as well as vehicle repair services.
59
+
60
+ #### transport_storage_post
61
+
62
+ Covers services related to transporting people and goods, storage facilities, and postal services.
63
+
64
+ #### accomodation_food
65
+
66
+ Refers to economic activities in tourism-related sectors such as hotels and restaurants.information_communicationEncompasses sectors dealing with information technology and telecommunications.
67
+
68
+ #### financial_activities
69
+
70
+ Includes banks, financial institutions, insurance companies, and various financial services.
71
+
72
+ #### real_state_activities
73
+
74
+ Refers to transactions involving buying, selling, or renting properties.
75
+
76
+ #### professional_activities
77
+
78
+ Covers a wide range of specialized professional services including consulting and administrative support.
79
+
80
+ #### public_admin_defense_health_edu
81
+
82
+ Represents public sector spending on government administration, national defense, public education, health care services, and social security programs.
83
+
84
+ #### private_edu_health
85
+
86
+ Refers to educational institutions and health care providers operating in the private sector.
87
+
88
+ #### art_culture_sport
89
+
90
+ Encompasses activities related to entertainment, cultural events, sports facilities, and other service-oriented sectors.
91
+
92
+ #### domestic_services
93
+
94
+ Includes personal services provided within households such as cleaning or caregiving.
95
+
96
+ #### taxes
97
+
98
+ Represents taxes levied on goods and services included in GDP calculations.
99
+
100
+ ### Source
101
+
102
+ Scientific Journal of Applied Social and Clinical Science - TIME SERIES ANALYSIS FOR THE QUARTERLY GROSS DOMESTIC PRODUCT OF AMAZONAS
103
+
104
+ ### Example
105
+
106
+ ```python
107
+ import matplotlib.pyplot as plt
108
+ from amazonasdatahub.datasets import get_dataset
109
+
110
+ # Load dataset
111
+ gdp_amazonas = get_dataset("gdp_amazonas")
112
+
113
+ # Select only year and taxes
114
+ df_gdp = gdp_amazonas[["year", "taxes"]]
115
+
116
+ # Plot time series
117
+ plt.figure(figsize=(9, 5))
118
+ plt.plot(
119
+ df_gdp["year"],
120
+ df_gdp["taxes"],
121
+ color="#cb181d",
122
+ linewidth=2,
123
+ )
124
+
125
+ # Add horizontal dashed line for the mean of taxes
126
+ mean_taxes = df_gdp["taxes"].mean()
127
+ plt.axhline(
128
+ y=mean_taxes,
129
+ color="gray",
130
+ linestyle="--",
131
+ linewidth=1.5,
132
+ )
133
+
134
+ # Information - Title, subtitle and style
135
+ plt.title(
136
+ "Quarterly GDP of Amazonas (2010-2021)", fontweight="bold", fontsize=14, loc="left"
137
+ )
138
+ plt.xlabel("Year")
139
+ plt.ylabel("Taxes")
140
+
141
+ plt.grid(True, linestyle=":", alpha=0.6)
142
+ plt.tight_layout()
143
+ plt.show()
144
+ ```
@@ -0,0 +1,84 @@
1
+ ---
2
+ title: "humidity_manaus"
3
+ ---
4
+
5
+ # humidity_manaus
6
+
7
+ Time series with Extreme Values of Limited Range
8
+
9
+ ### Description
10
+
11
+ A time series dataset consisting of the minimum relative humidity observed in the city of Manaus from January 2009 to December 2020. This dataset is a sample of size n = 144 monthly blocks.
12
+
13
+
14
+ ### Usage
15
+
16
+ ```python
17
+ humidity_manaus = get_dataset("humidity_manaus")
18
+ ```
19
+
20
+ ### Format
21
+
22
+ ‘humidity_manaus’ A tibble with 144 rows and 5 columns
23
+
24
+ #### year
25
+
26
+ The year in which this data was observed
27
+
28
+ #### rh
29
+
30
+ Relative Humidity
31
+
32
+ #### dbt
33
+
34
+ Dry Bulb Temperature
35
+
36
+ #### wbt
37
+
38
+ Wet Bulb Temperature
39
+
40
+ #### month
41
+
42
+ The month in which this data was observed
43
+
44
+
45
+ ### Source
46
+
47
+ NASCIMENTO, Leonardo Brandão Freitas; LIMA, Max Sousa; DUCZMAL, Luiz H. P-min-stable regression models for time series with extreme values of limited range. Environmetrics, Issue 2, v. 36, 2025.
48
+
49
+ ### Example
50
+
51
+ ```python
52
+ import matplotlib.pyplot as plt
53
+ import pandas as pd
54
+ from amazonasdatahub.datasets import get_dataset
55
+
56
+ # Load dataset
57
+ humidity_manaus = get_dataset("humidity_manaus")
58
+
59
+ # Create date column from year and month
60
+ humidity_manaus["date"] = pd.to_datetime(
61
+ humidity_manaus["year"].astype(str)
62
+ + "-"
63
+ + humidity_manaus["month"].astype(str)
64
+ + "-01"
65
+ )
66
+
67
+ # Sort by date for proper line plotting
68
+ humidity_manaus = humidity_manaus.sort_values("date")
69
+
70
+ # Plot time series
71
+ fig, ax = plt.subplots(figsize=(10, 5))
72
+ ax.plot(
73
+ humidity_manaus["date"], humidity_manaus["rh"], color="tab:blue", lw=1.5
74
+ )
75
+
76
+ # Titles and labels
77
+ ax.set_title("Relative Humidity of Amazonas (2010 - 2020)")
78
+ ax.set_xlabel("Date")
79
+ ax.set_ylabel("Relative Humidity")
80
+
81
+ plt.grid(axis="y", linestyle="--", alpha=0.5)
82
+ plt.tight_layout()
83
+ plt.show()
84
+ ```
@@ -0,0 +1,225 @@
1
+ ---
2
+ title: "malaria_amazonas"
3
+ ---
4
+
5
+ # malaria_amazonas
6
+
7
+ An integrated dataset of malaria notifications in the state of Amazonas
8
+
9
+ ### Description
10
+
11
+ This dataset contains medical records of patients who underwent malaria screening tests in the Legal Amazon. The data in this dataset were filtered to include only the cases reported in the state of Amazonas and for patients who reside specifically in the state of Amazonas between 2014 and 2019.
12
+
13
+ ### Usage
14
+
15
+ ```python
16
+ malaria_amazonas = get_dataset("malaria_amazonas")
17
+ ```
18
+
19
+ ### Format
20
+
21
+ ‘malaria_amazonas’ A data frame with 551633 rows and 35 columns:
22
+
23
+ #### notification_state
24
+
25
+ State of notification
26
+
27
+ #### notification_rh
28
+
29
+ Health region of notification
30
+
31
+ #### notification_county
32
+
33
+ County of notification
34
+
35
+ #### infection_country
36
+
37
+ Probable county where the patient was infected
38
+
39
+ #### infection_state
40
+
41
+ Probable state where the patient was infected
42
+
43
+ #### infection_hr
44
+
45
+ Probable health region where the patient was infected
46
+
47
+ #### infection_county
48
+
49
+ Probable county where the patient was infected
50
+
51
+ #### home_country
52
+
53
+ Country of residence of the patient
54
+
55
+ #### home_state
56
+
57
+ State of residence of the patient
58
+
59
+ #### home_hr
60
+
61
+ Health region of residence of the patient
62
+
63
+ #### home_county
64
+
65
+ County of residence of the patient
66
+
67
+ #### exam_interval
68
+
69
+ Time interval between notification and examination
70
+
71
+ #### treatment_interval
72
+
73
+ Time interval between examination and beginning of treatment
74
+
75
+ #### notification_interval
76
+
77
+ Time interval between symptom and notification
78
+
79
+ #### notification_month
80
+
81
+ Month in which the notification was recorded
82
+
83
+ #### notification_year
84
+
85
+ Year in which the notification was recorded
86
+
87
+ #### symptom_month
88
+
89
+ Month in which the patient felt the first symptoms of malaria
90
+
91
+ #### symptom_year
92
+
93
+ Year in which the patient felt the first symptoms of malaria
94
+
95
+ #### exam_month
96
+
97
+ Month in which the examination was performed
98
+
99
+ #### exam_year
100
+
101
+ Year in which the examination was performed
102
+
103
+ #### treatment_month
104
+
105
+ Month in which the treatment started
106
+
107
+ #### treatment_year
108
+
109
+ Year in which the treatment started
110
+
111
+ #### migration
112
+
113
+ Health region of residence different than that of notification
114
+
115
+ #### autochthonous_case
116
+
117
+ Health region of infection identical to that of residence
118
+
119
+ #### exam_result
120
+
121
+ Result of examination
122
+
123
+ #### detection_type
124
+
125
+ Type of detection
126
+
127
+ #### exam_type
128
+
129
+ Type of examination
130
+
131
+ #### symptom
132
+
133
+ Indicates if the patient felt a symptom
134
+
135
+ #### hemiparasite
136
+
137
+ The result of the examination for other hemiparasites
138
+
139
+ #### previous_treatment
140
+
141
+ Previous treatment for P. vivax or P.falciparum
142
+
143
+ #### occupation
144
+
145
+ Main activity in the last 15 days
146
+
147
+ #### education_level
148
+
149
+ Level of education of the patient
150
+
151
+ #### age
152
+
153
+ Interval of the age of the patient
154
+
155
+ #### race
156
+
157
+ Race/color of the patient
158
+
159
+ #### gender
160
+
161
+ Gender of the patient
162
+
163
+ #### pregnancy
164
+
165
+ Indicates pregnancy and the gestational age
166
+
167
+ #### crosses
168
+
169
+ Indicates the amount of parasitemia in crosses
170
+
171
+ #### cvl_case
172
+
173
+ Indicates the existence of cases of canine visceral leishmaniasis
174
+
175
+ #### scheme
176
+
177
+ Indicates the treatment scheme employed
178
+
179
+ #### qty_parasites
180
+
181
+ Indicates the number of parasites per mm^3
182
+
183
+ #### month
184
+
185
+ The month in which this data was observed
186
+
187
+ ### Source
188
+
189
+ https://www.synapse.org/Synapse:syn21552203/files
190
+
191
+ ### Example
192
+
193
+ ```python
194
+ import matplotlib.pyplot as plt
195
+ from amazonasdatahub.datasets import get_dataset
196
+
197
+ # Load dataset
198
+ malaria_amazonas = get_dataset("malaria_amazonas")
199
+
200
+ # Filter by year 2019 and count exam results
201
+ counts = (
202
+ malaria_amazonas[malaria_amazonas["exam_year"] == 2019]["exam_result"]
203
+ .value_counts()
204
+ )
205
+
206
+ # Plot bar chart
207
+ fig, ax = plt.subplots(figsize=(10, 6))
208
+ bars = ax.bar(counts.index, counts.values, color="skyblue", edgecolor="gray")
209
+
210
+ # Add text labels on top of bars
211
+ ax.bar_label(bars, padding=3)
212
+
213
+ # Titles and labels
214
+ ax.set_title(
215
+ "Results of malaria tests conducted in 2019\nDocumented cases in Amazonas and of patients residing in the state",
216
+ fontsize=10,
217
+ loc="left"
218
+ )
219
+ ax.set_xlabel("Result")
220
+ ax.set_ylabel("Count")
221
+
222
+ plt.grid(axis="y", linestyle="--", alpha=0.5)
223
+ plt.tight_layout()
224
+ plt.show()
225
+ ```
@@ -0,0 +1,167 @@
1
+ ---
2
+ title: "prf_amazonas"
3
+ ---
4
+
5
+ # prf_amazonas
6
+
7
+ Traffic accident data from Amazonas recorded by Federal Highway Police (PRF) in 2025
8
+
9
+ ### Description
10
+
11
+ Traffic accident data from Amazonas 2025
12
+
13
+ ### Usage
14
+
15
+ ```python
16
+ prf_amazonas = get_dataset("prf_amazonas")
17
+ ```
18
+
19
+ ### Format
20
+
21
+ ‘prf_amazonas’ A data frame with 116 rows and 30 variables:
22
+
23
+ #### id
24
+
25
+ Record ID
26
+
27
+ #### date
28
+
29
+ Date of the record - yyyy-mm-dd
30
+
31
+ #### days_of_week
32
+
33
+ Day of the week
34
+
35
+ #### time
36
+
37
+ Hour of the record
38
+
39
+ #### federative_unit
40
+
41
+ Federative unit (UF)
42
+
43
+ #### br
44
+
45
+ Federal Highway
46
+
47
+ #### km
48
+
49
+ Kilometer of BR
50
+
51
+ #### municipality
52
+
53
+ Municipality
54
+
55
+ #### accident_cause
56
+
57
+ Accident cause
58
+
59
+ #### accident_type
60
+
61
+ Accident type
62
+
63
+ #### accident_classification
64
+
65
+ Accident classification: victims, no victims, unharmed victims, fatal victims
66
+
67
+ #### road_direction
68
+
69
+ Road direction
70
+
71
+ #### weather
72
+
73
+ Weather conditions at the time of the accident
74
+
75
+ #### track_type
76
+
77
+ Track type: Simples, Múltipla ou Dupla
78
+
79
+ #### track_layout
80
+
81
+ Track layout
82
+
83
+ #### land_use
84
+
85
+ Land use
86
+
87
+ #### people
88
+
89
+ People involved in the accident
90
+
91
+ #### deceased
92
+
93
+ Death toll
94
+
95
+ #### minor_injuries
96
+
97
+ Number of victims with minor injuries
98
+
99
+ #### serious_injuries
100
+
101
+ Number of victims with serious injuries
102
+
103
+ #### unharmed
104
+
105
+ Number of unharmed victims
106
+
107
+ #### ignored
108
+
109
+ Ignored
110
+
111
+ #### harmed
112
+
113
+ Number of harmed victims
114
+
115
+ #### latitude
116
+
117
+ Latitude
118
+
119
+ #### longitude
120
+
121
+ Longitude
122
+
123
+ #### regional
124
+
125
+ Superintendency of the Federal Highway Police of Brazil
126
+
127
+ #### police_station
128
+
129
+ Police station where the report was filed
130
+
131
+ #### operating_unit
132
+
133
+ Operating unit and police station
134
+
135
+ ### Source
136
+
137
+ Brasil. Polícia Rodoviária Federal (PRF). Dados Abertos da PRF: Acidentes de Trânsito. https://www.gov.br/prf/pt-br/acesso-a-informacao/dados-abertos/dados-abertos-da-prf.
138
+
139
+ ### Example
140
+
141
+ ```python
142
+ import matplotlib.pyplot as plt
143
+ from amazonasdatahub.datasets import get_dataset
144
+
145
+ # Load dataset
146
+ prf_amazonas = get_dataset("prf_amazonas")
147
+
148
+ # Count occurrences by weather condition (automatically sorted descending)
149
+ counts = prf_amazonas["weather"].value_counts()
150
+
151
+ # Plot bar chart
152
+ fig, ax = plt.subplots(figsize=(9, 6))
153
+ bars = ax.bar(counts.index, counts.values, color="steelblue", edgecolor="gray")
154
+
155
+ # Add text labels on top of bars
156
+ ax.bar_label(bars, padding=3)
157
+
158
+ # Titles and labels
159
+ ax.set_title("Accident count by weather condition", loc="left")
160
+ ax.set_xlabel("Weather")
161
+ ax.set_ylabel("Count")
162
+
163
+ plt.xticks(rotation=45, ha="right")
164
+ plt.grid(axis="y", linestyle="--", alpha=0.5)
165
+ plt.tight_layout()
166
+ plt.show()
167
+ ```
@@ -0,0 +1,79 @@
1
+ ---
2
+ title: "rionegro_amazonas"
3
+ ---
4
+
5
+ # rionegro_amazonas
6
+
7
+ A dataset of the Rio Negro River (Amazonas) level from 2003 to 2023.
8
+
9
+ ### Description
10
+
11
+ This dataset contains data of the Rio Negro River level in the state of Amazonas (Brazil), compiling information on years, semesters and days, along with the river's level in meters and whether it filled or dropped (in centimeters).
12
+
13
+ ### Usage
14
+
15
+ ```python
16
+ rionegro_amazonas = get_dataset("rionegro_amazonas")
17
+ ```
18
+
19
+ ### Format
20
+
21
+ ‘rionegro_amazonas’ A data frame with 8003 rows and 7 columns:
22
+
23
+ #### level_m
24
+
25
+ River level in meters
26
+
27
+ #### increase_decrease_cm
28
+
29
+ Wheter the river level filled or dropped (in centimeters)
30
+
31
+ #### day
32
+
33
+ Measurement day
34
+
35
+ #### month
36
+
37
+ Measurement month
38
+
39
+ #### year
40
+
41
+ Measurement year
42
+
43
+ #### semester
44
+
45
+ Measurement semester
46
+
47
+ ### Source
48
+
49
+ https://portodemanaus.com.br/nivel-do-rio-negro/
50
+
51
+ ### Example
52
+
53
+ ```python
54
+ import matplotlib.pyplot as plt
55
+ from amazonasdatahub.datasets import get_dataset
56
+
57
+ # Load dataset
58
+ rionegro_amazonas = get_dataset("rionegro_amazonas")
59
+
60
+ # Prepare data for boxplot grouped by year
61
+ years = sorted(rionegro_amazonas["year"].unique())
62
+ data_by_year = [
63
+ rionegro_amazonas[rionegro_amazonas["year"] == yr]["level_m"].dropna()
64
+ for yr in years
65
+ ]
66
+
67
+ # Plot boxplot
68
+ fig, ax = plt.subplots(figsize=(10, 5))
69
+ ax.boxplot(data_by_year, tick_labels=years)
70
+
71
+ # Labels
72
+ ax.set_xlabel("Year")
73
+ ax.set_ylabel("Water level (m)")
74
+
75
+ plt.xticks(rotation=45, ha="right")
76
+ plt.grid(axis="y", linestyle="--", alpha=0.5)
77
+ plt.tight_layout()
78
+ plt.show()
79
+ ```
@@ -0,0 +1,132 @@
1
+ ---
2
+ title: "srl_muni"
3
+ ---
4
+
5
+ # srl_muni
6
+
7
+ Physical literacy and reading performance of children in schools in Amazonas.
8
+
9
+ ### Description
10
+
11
+ This is a dataset from an association, cross-sectional, quantitative study carried out with Amazonian schoolchildren (n=100; aged between 10 and 13 years) from 3 public schools in the municipality of Borba (Amazonas).
12
+
13
+ ### Usage
14
+
15
+ ```python
16
+ srl_muni = get_dataset("srl_muni")
17
+ ```
18
+
19
+ ### Format
20
+
21
+ ‘srl_muni’ A data frame with 100 rows and 17 columns:
22
+
23
+ #### school
24
+
25
+ School of observation
26
+
27
+ #### sex
28
+
29
+ Sex - 1 for Masculine and 2 for Feminine
30
+
31
+ #### age
32
+
33
+ Age (in years)
34
+
35
+ #### weight_kg
36
+
37
+ Weight in kilograms (kg)
38
+
39
+ #### height_m
40
+
41
+ Height in meters (m)
42
+
43
+ #### bmi
44
+
45
+ Body Mass Index (BMI)
46
+
47
+ #### bmi_status
48
+
49
+ Body Mass Index Status - A categorical description of the BMI.
50
+
51
+ #### phv
52
+
53
+ Peak Height Velocity (PHV) is a continuous variable, measured by age (in years) relative to the peak height in the period where maximum rate of growth occurs and this is an indication of maturity.
54
+
55
+ #### phv_state
56
+
57
+ Categorical description for Peak Height Velocity (PHV).
58
+
59
+ #### eses
60
+
61
+ Exercise Self-Efficacy Scale measures how confident the students are with regard to carrying out regular physical activities and exercise, measured by a psychometric scale.
62
+
63
+ #### pmc
64
+
65
+ Perceived Motor Competence (PMC) assesses the child's self-perception regarding their ability to perform motor movements. Measured by a psychometric scale.
66
+
67
+ #### kupa
68
+
69
+ Knowledge and Understanding of Physical Activity (KUPA) - Evaluates knowledge regarding the benefits, safety, and engagement in physical activity. Measured by scores obtained in objective questions.
70
+
71
+ #### sb
72
+
73
+ Sedentary Behavior - Evalutes the exposition time to sedentary behaviors. Measured by psychometric scale.
74
+
75
+ #### pa
76
+
77
+ Physical Activity (PA) - Level of physical activity in children, based on the frequency and duration of routine daily activities. Measured by score on the physical activity frequency questions.
78
+
79
+ #### mc
80
+
81
+ Motor Competence - Supine To Stand (in seconds) - Measures the time (in seconds) it takes for the child to stand up from the floor, from a supine position to a standing position.
82
+
83
+ #### tde
84
+
85
+ Total Score on the TDE test - Measures reading level based on time and accuracy in word reading.
86
+
87
+ #### tde_categorical
88
+
89
+ Categorical description of the TDE Score.
90
+
91
+ ### Source
92
+
93
+ https://tede.ufam.edu.br/handle/tede/10627
94
+
95
+ ### Example
96
+
97
+ ```python
98
+ import matplotlib.pyplot as plt
99
+ import numpy as np
100
+ from matplotlib.colors import LinearSegmentedColormap
101
+ from amazonasdatahub.datasets import get_dataset
102
+
103
+ srl_muni = get_dataset("srl_muni")
104
+
105
+ # Selecting numeric variables and computing the correlation matrix
106
+ corr = srl_muni.select_dtypes("number").corr()
107
+ labels = corr.columns
108
+
109
+ # Plotting the correlation matrix
110
+ cmap = LinearSegmentedColormap.from_list("corr", ["#2166AC", "white", "#d50e0b"])
111
+
112
+ fig, ax = plt.subplots(figsize=(8, 8))
113
+ im = ax.imshow(corr.values, cmap=cmap, vmin=-1, vmax=1)
114
+
115
+ ax.set_xticks(np.arange(len(labels)), labels=labels, rotation=45, ha="right")
116
+ ax.set_yticks(np.arange(len(labels)), labels=labels)
117
+
118
+ # Cell borders and value labels
119
+ ax.set_xticks(np.arange(-0.5, len(labels), 1), minor=True)
120
+ ax.set_yticks(np.arange(-0.5, len(labels), 1), minor=True)
121
+ ax.grid(which="minor", color="white", linewidth=1)
122
+ ax.tick_params(which="minor", length=0)
123
+
124
+ for i in range(len(labels)):
125
+ for j in range(len(labels)):
126
+ ax.text(j, i, f"{corr.values[i, j]:.2f}", ha="center", va="center", fontsize=8)
127
+
128
+ fig.colorbar(im, ax=ax, shrink=0.7, label="Correlation")
129
+ ax.set_title("Correlation matrix: Motor Competence\nand Reading Performance")
130
+ plt.tight_layout()
131
+ plt.show()
132
+ ```
@@ -0,0 +1,209 @@
1
+ Metadata-Version: 2.4
2
+ Name: amazonasdatahub
3
+ Version: 0.2.4
4
+ Summary: The goal of amazonasdatahub is to gather various data sets from the state of Amazonas (AM), Brazil, to which Deep Learning can be applied.
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: Nelson Geraldo Aquino de Carvalho
8
+ Requires-Python: >=3.12,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Requires-Dist: pandas (>=3.0.2,<4.0.0)
15
+ Requires-Dist: pyarrow (>=24.0.0,<25.0.0)
16
+ Requires-Dist: python-frontmatter (>=1.1.0,<2.0.0)
17
+ Requires-Dist: requests (>=2.33.1,<3.0.0)
18
+ Description-Content-Type: text/markdown
19
+
20
+ # amazonasdatahub
21
+
22
+ ![amazonasdatahub logo](assets/figures/logo_amazonasdatahub_small.png)
23
+ <!-- badges: start -->
24
+
25
+ <!-- badges: end -->
26
+
27
+ The goal of `amazonasdatahub` is to aggregate databases from the State
28
+ of Amazonas (AM), Brazil, for conducting studies and preparing
29
+ educational materials, as well as to facilitate access to organized and
30
+ processed data, thereby supporting research and teaching and enabling
31
+ the application of statistical methods.
32
+
33
+ Full documentation of both Python and R versions is available in the
34
+ following languages/Documentação das versões em Python e R estão
35
+ disponíveis nos seguintes idiomas:
36
+
37
+ - [English
38
+ documentation](https://onelsoncarvalho.github.io/amazonasdatahubsite/en/)
39
+ - [🇧🇷 Documentação em Português
40
+ (BR)](https://onelsoncarvalho.github.io/amazonasdatahubsite/)
41
+
42
+ Python only documentation:
43
+
44
+ - [English documentation for Python
45
+ version](https://onelsoncarvalho.github.io/amazonasdatahubpy/en/)
46
+ - [🇧🇷 Documentação em Português (BR) para versão do
47
+ Python](https://onelsoncarvalho.github.io/amazonasdatahubpy/br/)
48
+
49
+ ## Overview
50
+
51
+ This `amazonasdatahub` package provides databases from various types and
52
+ sources, all of which concern the State of Amazonas.
53
+
54
+ List of available datasets:
55
+
56
+ | Dataset | Area | Source |
57
+ |:---|:--:|:---|
58
+ | agriculture_amazonas | Agriculture and Livestock | Institute of Agricultural and Sustainable Forestry Development of the State of Amazonas - 2024 |
59
+ | aids_amazonas | Health | Department of HIV, AIDS, Tuberculosis, Viral Hepatitis, and Sexually Transmitted Infections, 2024 |
60
+ | gdp_amazonas | Economy | Scientific Journal of Applied Social and Clinical Science - TIME SERIES ANALYSIS FOR THE QUARTERLY GROSS DOMESTIC PRODUCT OF AMAZONAS |
61
+ | humidity_manaus | Climate | NASCIMENTO, Leonardo Brandão Freitas; LIMA, Max Sousa; DUCZMAL, Luiz H. P-min-stable regression models for time series with extreme values of limited range. Environmetrics, Issue 2, v. 36, 2025. |
62
+ | malaria_amazonas | Health | Lais Baroni, M. P. (2020). An Integrated Dataset of Malaria Notifications in the Legal Amazon (Dataset). Synapse. <https://doi.org/10.7303/SYN21552203> |
63
+ | prf_amazonas | Road Safety | Brasil. Polícia Rodoviária Federal (PRF). Dados Abertos da PRF: Acidentes de Trânsito |
64
+ | rionegro_amazonas | Environment | Porto de Manaus. Nível do Rio Negro |
65
+ | srl_muni | Education | ALMEIDA, Thiago da Cruz de. Physical Literacy e desempenho em leitura de escolares amazônicos: um estudo de associação. 2024. 104 f. Dissertação (Mestrado em Educação) - Universidade Federal do Amazonas, Manaus, 2024. |
66
+
67
+ ## Installation
68
+
69
+ To install `amazonasdatahub`, you need the following tools installed on your computer or development environment:
70
+
71
+ - Python 3.14.3
72
+ - `pip` (package manager)
73
+ - Git
74
+
75
+ You can install the development version of `amazonasdatahub` using `git clone` to clone the remote repository into your local environment and `pip` to install it:
76
+ ```
77
+ # cloning
78
+ git clone https://github.com/onelsoncarvalho/amazonasdatahubpy amazonasdatahub
79
+ cd amazonasdatahub
80
+
81
+ # installing
82
+ pip install amazonasdatahub
83
+ ```
84
+
85
+ ## Usage and Examples
86
+
87
+ ### Loading `amazonasdatahub`
88
+
89
+ Use `import` and `from` to require the functions from `datasets` module of `amazonasdatahub`:
90
+
91
+ ``` python
92
+ from amazonasdatahub.datasets import get_dataset
93
+ ```
94
+
95
+ The dataset name should be provided as argument of `get_dataset(dataset: str)` function.
96
+
97
+ ```python
98
+ agriculture_amazonas = get_dataset('agriculture_amazonas')
99
+ aids_amazonas = get_dataset('aids_amazonas')
100
+ gdp_amazonas = get_dataset('gdp_amazonas')
101
+ ```
102
+
103
+ ### Get dataset documentation
104
+
105
+ Each dataset has its own documentation to provide the user information about the dataset variables.
106
+
107
+ Use `import` and `from` to require the functions from `docs` module:
108
+
109
+ ```python
110
+ from amazonasdatahub.docs import get_doc
111
+ ```
112
+
113
+ The dataset name should be provided as argument of `get_docs(dataset: str)` function.
114
+
115
+ ```python
116
+ get_doc('agriculture_amazonas')
117
+ get_doc('aids_amazonas')
118
+ get_doc('gdp_amazonas')
119
+ ```
120
+
121
+ <!-- ### Examples
122
+
123
+ #### Disease occurrence
124
+
125
+ The dataset `aids_amazonas` contains data of the AIDS occurrences in
126
+ each municipality from Amazonas.
127
+
128
+ One of the analysis that can be made is: visualize the time series of
129
+ counts filtered by municipality, where each case is grouped by the
130
+ sex/gender of each observation. To do this, we will use the dplyr
131
+ package to structure the data and the ggplot2 package to create and
132
+ customize the chart.
133
+
134
+ ``` r
135
+ # Loading dplyr and ggplot to structure the data
136
+ require(dplyr)
137
+ require(ggplot2)
138
+ ```
139
+
140
+ ``` r
141
+ # Filtering by municipality and plotting case count by gender
142
+ aids_amazonas %>%
143
+ filter(name_muni == "Manaus") %>%
144
+ group_by(gender) %>%
145
+ ggplot(aes(x = year, y = cases, group = gender, color = gender)) +
146
+ geom_line() +
147
+ scale_color_manual(values = c("blue", "red")) +
148
+ theme_minimal() +
149
+ labs(
150
+ title = "AIDS occurrences in Manaus (2011-2023)",
151
+ x = "Year",
152
+ y = "Case count",
153
+ color = "Gender"
154
+ )
155
+ ```
156
+
157
+ <img src="man/figures/README-unnamed-chunk-6-1.png" alt="" width="100%" />
158
+
159
+ #### Time Series
160
+
161
+ The `humidity_manaus` consists of the minimum relative humidity observed
162
+ in the city of Manaus from January 2009 to December 2020. We can
163
+ visualize the time series of the relative humidity during this time
164
+ interval.
165
+
166
+ Using `dplyr`, it is possible to create a date column, which will be
167
+ composed of the month and year. Using`ggplot2`, the time series chart
168
+ can be plotted.
169
+
170
+ ``` r
171
+ # Loading dplyr and ggplot to structure the data
172
+ require(dplyr)
173
+ require(ggplot2)
174
+
175
+ # Creating date column and plotting the time series
176
+ humidity_manaus %>%
177
+ mutate(date = as.Date(paste0(year, "-", month, "-","01"))) %>%
178
+ ggplot(aes(x = date, y = rh)) +
179
+ geom_line() +
180
+ theme_minimal() +
181
+ labs(
182
+ title = "Relative Humidity of Amazonas (2009-2020)",
183
+ x = "Date",
184
+ y = "Relative Humidity"
185
+ )
186
+ ```
187
+
188
+ <img src="man/figures/README-unnamed-chunk-7-1.png" alt="" width="100%" /> -->
189
+
190
+
191
+ ## Contributing
192
+
193
+ Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
194
+
195
+ ## License
196
+
197
+ `amazonasdatahub` was created by Nelson Geraldo Aquino de Carvalho. It is licensed under the terms of the MIT license.
198
+
199
+ <!-- ## Credits
200
+
201
+ `amazonasdatahub` was created with [`cookiecutter`](https://cookiecutter.readthedocs.io/en/latest/) and the `py-pkgs-cookiecutter` [template](https://github.com/py-pkgs/py-pkgs-cookiecutter). -->
202
+
203
+ ## Citation
204
+
205
+ - CARVALHO, Nelson Geraldo Aquino de; NASCIMENTO, Leonardo Brandão
206
+ Freitas do. **amazonasdatahub**. 2026.
207
+ <https://onelsoncarvalho.github.io/amazonasdatahubpy>.
208
+
209
+
@@ -0,0 +1,15 @@
1
+ amazonasdatahub/__init__.py,sha256=5JgY-IAZT-r0A1dv8henW4V1sXniUqgCfes0ab42_D4,118
2
+ amazonasdatahub/datasets.py,sha256=h0UJ8-x1mdgInY8yYQnkFacplKWTYrV2_YnyT3VvXE8,1213
3
+ amazonasdatahub/docs.py,sha256=6yJxHuNNZSlD6jdUQyIlKiuPzW8O7OS0qIIsIqpRnxo,901
4
+ amazonasdatahub/documentations/agriculture_amazonas.md,sha256=_7BnQa3DRtfPc25OoHn54D0Wr2_6b6WtxJQI1158ii0,1943
5
+ amazonasdatahub/documentations/aids_amazonas.md,sha256=BbVkTA6fRbwy_5BZLNfXTt9IkAxeGeWN7twmg0sA7ws,1288
6
+ amazonasdatahub/documentations/gdp_amazonas.md,sha256=ojxPPvwDth-gJx0vqLIdKI0b9xOUKk3P8lBakBlN40w,3829
7
+ amazonasdatahub/documentations/humidity_manaus.md,sha256=VsuF6fsnx2c-KuyoMgiCj-d1aWmsF167s1xTj_zluMw,1711
8
+ amazonasdatahub/documentations/malaria_amazonas.md,sha256=Qs1o4z-GAUY5lnN53FYVpUk0uF2V9qcR_UZG8Q7OpNs,4034
9
+ amazonasdatahub/documentations/prf_amazonas.md,sha256=HQWCK_U2xa_itNmA_TG5Wki_ZR25L1cMcUDbkNm5ZJs,2466
10
+ amazonasdatahub/documentations/rionegro_amazonas.md,sha256=MyHApcegRNC6GTs9hnefNaw1QUav53dycgJELGtehas,1510
11
+ amazonasdatahub/documentations/srl_muni.md,sha256=wNA1F2gphJU5qrVW5jcQLZNtNzrfiedBeslN2RydEPI,3633
12
+ amazonasdatahub-0.2.4.dist-info/METADATA,sha256=Pm8RZHipsQEo9Q9ms_LUzeqF7wR3zWLfywdaahUHHlo,7458
13
+ amazonasdatahub-0.2.4.dist-info/WHEEL,sha256=EGEvSphFYqXKs23-kQBeyNoJP1nrT8ZJKQoi5p5DYL8,88
14
+ amazonasdatahub-0.2.4.dist-info/licenses/LICENSE,sha256=Y1y_XO9X6N-aoaPQ91bwmKAtn6Up1pttUd8dyJ7NV44,1092
15
+ amazonasdatahub-0.2.4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.4.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026, Nelson Geraldo Aquino de Carvalho
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+