condepe 0.1.0__tar.gz
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.
- condepe-0.1.0/.github/workflows/ci.yml +41 -0
- condepe-0.1.0/.github/workflows/docs.yml +21 -0
- condepe-0.1.0/.github/workflows/pypi.yml +51 -0
- condepe-0.1.0/.gitignore +9 -0
- condepe-0.1.0/LICENSE +21 -0
- condepe-0.1.0/NEWS.md +6 -0
- condepe-0.1.0/PKG-INFO +133 -0
- condepe-0.1.0/README.md +75 -0
- condepe-0.1.0/docs/api.md +33 -0
- condepe-0.1.0/docs/assets/extra.css +12 -0
- condepe-0.1.0/docs/assets/logo.svg +49 -0
- condepe-0.1.0/docs/assets/suape.png +0 -0
- condepe-0.1.0/docs/assets/tmi.png +0 -0
- condepe-0.1.0/docs/examples.md +129 -0
- condepe-0.1.0/docs/getting-started.md +200 -0
- condepe-0.1.0/docs/index.md +73 -0
- condepe-0.1.0/docs/news.md +6 -0
- condepe-0.1.0/docs/precompile.py +317 -0
- condepe-0.1.0/mkdocs.yml +61 -0
- condepe-0.1.0/pyproject.toml +63 -0
- condepe-0.1.0/src/condepe/__init__.py +53 -0
- condepe-0.1.0/src/condepe/_client.py +167 -0
- condepe-0.1.0/src/condepe/_msg.py +31 -0
- condepe-0.1.0/src/condepe/data.py +226 -0
- condepe-0.1.0/tests/test_condepe.py +165 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
schedule:
|
|
8
|
+
# Weekly, after the Saturday publication cycle of the Observatory.
|
|
9
|
+
- cron: "0 12 * * 0"
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
# macOS left out: the code is OS-independent and GitHub's macOS arm64
|
|
19
|
+
# runners were unavailable (jobs cancelled after 15 min in the queue).
|
|
20
|
+
os: [ubuntu-latest, windows-latest]
|
|
21
|
+
python: ["3.10", "3.13"]
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
- uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python }}
|
|
27
|
+
- run: pip install -e ".[dev]"
|
|
28
|
+
- run: ruff check .
|
|
29
|
+
- run: pytest -q
|
|
30
|
+
|
|
31
|
+
# The ADR 0006 acceptance check: from a runner outside Brazil, the package
|
|
32
|
+
# must return Recife's population (canonical endpoint or the mirror).
|
|
33
|
+
live:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.13"
|
|
40
|
+
- run: pip install -e ".[dev]"
|
|
41
|
+
- run: pytest -q -m live
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Builds the site from the precompiled pages (no network needed) and
|
|
2
|
+
# publishes it to the gh-pages branch. Manual until the repository is made
|
|
3
|
+
# public: GitHub Pages of a private repository would still be public.
|
|
4
|
+
name: docs
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
docs:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.13"
|
|
20
|
+
- run: pip install -e ".[docs]"
|
|
21
|
+
- run: mkdocs gh-deploy --force --strict
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Publishes condepe to PyPI via trusted publishing (OIDC, no token).
|
|
2
|
+
# Runs on tags v* (e.g. v0.1.0) or manually. Register once on pypi.org
|
|
3
|
+
# (Publishing -> pending publisher): owner StrategicProjects, repository
|
|
4
|
+
# condepe-py, workflow pypi.yml, environment pypi. Do not rename this file.
|
|
5
|
+
name: pypi
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ["v*"]
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
- name: Tag matches the declared version
|
|
24
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
25
|
+
run: |
|
|
26
|
+
declared=$(grep -m1 '^version' pyproject.toml | cut -d'"' -f2)
|
|
27
|
+
test "v$declared" = "$GITHUB_REF_NAME" || { echo "tag $GITHUB_REF_NAME, pyproject $declared"; exit 1; }
|
|
28
|
+
- run: pip install build twine
|
|
29
|
+
- run: python -m build
|
|
30
|
+
- run: twine check dist/*
|
|
31
|
+
- run: pip install dist/*.whl && python -I -c "import condepe; print(condepe.__version__)"
|
|
32
|
+
- uses: actions/upload-artifact@v4
|
|
33
|
+
with:
|
|
34
|
+
name: dist
|
|
35
|
+
path: dist/
|
|
36
|
+
|
|
37
|
+
publish:
|
|
38
|
+
needs: build
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
environment: pypi
|
|
41
|
+
permissions:
|
|
42
|
+
id-token: write
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/download-artifact@v4
|
|
45
|
+
with:
|
|
46
|
+
name: dist
|
|
47
|
+
path: dist/
|
|
48
|
+
# A Docker action: pin the release tag, not a commit SHA.
|
|
49
|
+
- uses: pypa/gh-action-pypi-publish@v1.14.2
|
|
50
|
+
with:
|
|
51
|
+
skip-existing: true
|
condepe-0.1.0/.gitignore
ADDED
condepe-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 condepe authors
|
|
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.
|
condepe-0.1.0/NEWS.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# condepe 0.1.0
|
|
2
|
+
|
|
3
|
+
* First version: `condepe_catalog()`, `condepe_indicators()`, `condepe_data()`,
|
|
4
|
+
`condepe_series()` and `condepe_localities()`, reading the Observatory open data
|
|
5
|
+
(canonical endpoint, Hugging Face mirror as fallback) with a disk cache per
|
|
6
|
+
catalogue version and sha256 verification.
|
condepe-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: condepe
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Access the open data of the Pernambuco Observatory (Condepe/Fidem) from Python
|
|
5
|
+
Project-URL: Homepage, https://strategicprojects.github.io/condepe-py/
|
|
6
|
+
Project-URL: Data, https://cf.pe.gov.br/observatorio
|
|
7
|
+
Project-URL: Repository, https://github.com/StrategicProjects/condepe-py
|
|
8
|
+
Project-URL: Issues, https://github.com/StrategicProjects/condepe-py/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/StrategicProjects/condepe-py/blob/main/NEWS.md
|
|
10
|
+
Author-email: André Leite <leite@castlab.org>, Marcos Wasiliew <marcos.wasiliew@gmail.com>, Hugo Vasconcelos <hugo.vasconcelos@ufpe.br>, Carlos Amorim <carlos.agaf@ufpe.br>, Diogo Bezerra <diogo.bezerra@ufpe.br>, Júlia Nascimento Barreto <juliabarreto@gd.seplag.pe.gov.br>
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2026 condepe authors
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Keywords: Brazil,Condepe/Fidem,Pernambuco,municipalities,open-data,pandas,statistics
|
|
34
|
+
Classifier: Development Status :: 4 - Beta
|
|
35
|
+
Classifier: Intended Audience :: Science/Research
|
|
36
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python :: 3
|
|
39
|
+
Classifier: Topic :: Scientific/Engineering
|
|
40
|
+
Requires-Python: >=3.10
|
|
41
|
+
Requires-Dist: pandas>=1.3
|
|
42
|
+
Requires-Dist: platformdirs>=3
|
|
43
|
+
Requires-Dist: pyarrow>=10
|
|
44
|
+
Requires-Dist: requests>=2.25
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
48
|
+
Requires-Dist: responses>=0.23; extra == 'dev'
|
|
49
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
50
|
+
Provides-Extra: docs
|
|
51
|
+
Requires-Dist: matplotlib>=3.5; extra == 'docs'
|
|
52
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
53
|
+
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
|
|
54
|
+
Provides-Extra: test
|
|
55
|
+
Requires-Dist: pytest>=7; extra == 'test'
|
|
56
|
+
Requires-Dist: responses>=0.23; extra == 'test'
|
|
57
|
+
Description-Content-Type: text/markdown
|
|
58
|
+
|
|
59
|
+
# condepe <img src="docs/assets/logo.svg" align="right" height="139" alt="condepe hex logo" />
|
|
60
|
+
|
|
61
|
+
Python access to the open data of the **Observatório de Pernambuco**, published by
|
|
62
|
+
[Condepe/Fidem](https://cf.pe.gov.br) (the Pernambuco State Agency for Planning and
|
|
63
|
+
Research): municipal series on population, economy, public finance, labour,
|
|
64
|
+
education, health, security, transport and environment for the 185
|
|
65
|
+
municipalities of Pernambuco, Brazil.
|
|
66
|
+
|
|
67
|
+
Every source is published in the same long format (one observation per row, 15
|
|
68
|
+
columns), so one set of functions covers all of them.
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install condepe
|
|
74
|
+
# development version:
|
|
75
|
+
pip install git+https://github.com/StrategicProjects/condepe-py
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Usage
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
import condepe
|
|
82
|
+
|
|
83
|
+
# Sources available (one row each), with the catalogue version
|
|
84
|
+
cat = condepe.condepe_catalog()
|
|
85
|
+
cat.attrs["version"]
|
|
86
|
+
|
|
87
|
+
# Indicators of a source
|
|
88
|
+
condepe.condepe_indicators("sidra_populacao_estimada")
|
|
89
|
+
|
|
90
|
+
# A series: Recife (IBGE 2611606), 2020 onwards
|
|
91
|
+
condepe.condepe_series(
|
|
92
|
+
"sidra_populacao_estimada",
|
|
93
|
+
"Populacao residente estimada",
|
|
94
|
+
code="2611606",
|
|
95
|
+
years=range(2020, 2027),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
# A whole source, and the municipality list
|
|
99
|
+
condepe.condepe_data("datasus_sinasc")
|
|
100
|
+
condepe.condepe_localities()
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Column names are kept in Portuguese, as published, so results stay traceable to
|
|
104
|
+
the official files: `cd_municipio_ibge`, `nm_municipio`, `ano`, `mes`,
|
|
105
|
+
`indicador`, `indicador_base`, `valor`, `unidade`, `natureza`, `id_fonte`,
|
|
106
|
+
`eixo`, `tema`, `assunto`, `fonte_original`, `arquivo_origem`. Monthly series
|
|
107
|
+
carry the period in `indicador` (`"… [MM/YYYY]"`) and `mes`; `indicador_base` is
|
|
108
|
+
the label without it.
|
|
109
|
+
|
|
110
|
+
## Where the data come from
|
|
111
|
+
|
|
112
|
+
- **Canonical:** <https://cf.pe.gov.br/observatorio/dados/atual/>
|
|
113
|
+
- **Mirror (fallback):** the Hugging Face dataset
|
|
114
|
+
[`mlkwy/observatorio-pernambuco`](https://huggingface.co/datasets/mlkwy/observatorio-pernambuco),
|
|
115
|
+
with the same relative paths.
|
|
116
|
+
|
|
117
|
+
Files are cached on disk per catalogue version (`condepe_cache_dir()`) and
|
|
118
|
+
checked against the sha256 published in the catalogue. The catalogue itself is
|
|
119
|
+
trusted for 6 hours. Set `CONDEPE_URL`, `CONDEPE_MIRROR_URL` or
|
|
120
|
+
`CONDEPE_CACHE_DIR` to override the defaults.
|
|
121
|
+
|
|
122
|
+
Documentation: <https://strategicprojects.github.io/condepe-py/>.
|
|
123
|
+
|
|
124
|
+
## Citation and license
|
|
125
|
+
|
|
126
|
+
Data: Condepe/Fidem, *Observatório de Pernambuco — Base de Dados do Estado*,
|
|
127
|
+
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The citation with the
|
|
128
|
+
version in use is in `condepe_catalog().attrs["citation"]`.
|
|
129
|
+
|
|
130
|
+
Code: MIT. To read or write *private* buckets on `s3.pe.gov.br` with an
|
|
131
|
+
access key, see [`s3pe`](https://github.com/StrategicProjects/s3pe); `condepe`
|
|
132
|
+
needs no key, since the Observatory open data are public. An R package with the same functions is
|
|
133
|
+
[`condepe` for R](https://github.com/StrategicProjects/condepe-r).
|
condepe-0.1.0/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# condepe <img src="docs/assets/logo.svg" align="right" height="139" alt="condepe hex logo" />
|
|
2
|
+
|
|
3
|
+
Python access to the open data of the **Observatório de Pernambuco**, published by
|
|
4
|
+
[Condepe/Fidem](https://cf.pe.gov.br) (the Pernambuco State Agency for Planning and
|
|
5
|
+
Research): municipal series on population, economy, public finance, labour,
|
|
6
|
+
education, health, security, transport and environment for the 185
|
|
7
|
+
municipalities of Pernambuco, Brazil.
|
|
8
|
+
|
|
9
|
+
Every source is published in the same long format (one observation per row, 15
|
|
10
|
+
columns), so one set of functions covers all of them.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install condepe
|
|
16
|
+
# development version:
|
|
17
|
+
pip install git+https://github.com/StrategicProjects/condepe-py
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
import condepe
|
|
24
|
+
|
|
25
|
+
# Sources available (one row each), with the catalogue version
|
|
26
|
+
cat = condepe.condepe_catalog()
|
|
27
|
+
cat.attrs["version"]
|
|
28
|
+
|
|
29
|
+
# Indicators of a source
|
|
30
|
+
condepe.condepe_indicators("sidra_populacao_estimada")
|
|
31
|
+
|
|
32
|
+
# A series: Recife (IBGE 2611606), 2020 onwards
|
|
33
|
+
condepe.condepe_series(
|
|
34
|
+
"sidra_populacao_estimada",
|
|
35
|
+
"Populacao residente estimada",
|
|
36
|
+
code="2611606",
|
|
37
|
+
years=range(2020, 2027),
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# A whole source, and the municipality list
|
|
41
|
+
condepe.condepe_data("datasus_sinasc")
|
|
42
|
+
condepe.condepe_localities()
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Column names are kept in Portuguese, as published, so results stay traceable to
|
|
46
|
+
the official files: `cd_municipio_ibge`, `nm_municipio`, `ano`, `mes`,
|
|
47
|
+
`indicador`, `indicador_base`, `valor`, `unidade`, `natureza`, `id_fonte`,
|
|
48
|
+
`eixo`, `tema`, `assunto`, `fonte_original`, `arquivo_origem`. Monthly series
|
|
49
|
+
carry the period in `indicador` (`"… [MM/YYYY]"`) and `mes`; `indicador_base` is
|
|
50
|
+
the label without it.
|
|
51
|
+
|
|
52
|
+
## Where the data come from
|
|
53
|
+
|
|
54
|
+
- **Canonical:** <https://cf.pe.gov.br/observatorio/dados/atual/>
|
|
55
|
+
- **Mirror (fallback):** the Hugging Face dataset
|
|
56
|
+
[`mlkwy/observatorio-pernambuco`](https://huggingface.co/datasets/mlkwy/observatorio-pernambuco),
|
|
57
|
+
with the same relative paths.
|
|
58
|
+
|
|
59
|
+
Files are cached on disk per catalogue version (`condepe_cache_dir()`) and
|
|
60
|
+
checked against the sha256 published in the catalogue. The catalogue itself is
|
|
61
|
+
trusted for 6 hours. Set `CONDEPE_URL`, `CONDEPE_MIRROR_URL` or
|
|
62
|
+
`CONDEPE_CACHE_DIR` to override the defaults.
|
|
63
|
+
|
|
64
|
+
Documentation: <https://strategicprojects.github.io/condepe-py/>.
|
|
65
|
+
|
|
66
|
+
## Citation and license
|
|
67
|
+
|
|
68
|
+
Data: Condepe/Fidem, *Observatório de Pernambuco — Base de Dados do Estado*,
|
|
69
|
+
[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). The citation with the
|
|
70
|
+
version in use is in `condepe_catalog().attrs["citation"]`.
|
|
71
|
+
|
|
72
|
+
Code: MIT. To read or write *private* buckets on `s3.pe.gov.br` with an
|
|
73
|
+
access key, see [`s3pe`](https://github.com/StrategicProjects/s3pe); `condepe`
|
|
74
|
+
needs no key, since the Observatory open data are public. An R package with the same functions is
|
|
75
|
+
[`condepe` for R](https://github.com/StrategicProjects/condepe-r).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# API reference
|
|
2
|
+
|
|
3
|
+
## Discover
|
|
4
|
+
|
|
5
|
+
::: condepe.condepe_catalog
|
|
6
|
+
|
|
7
|
+
::: condepe.condepe_indicators
|
|
8
|
+
|
|
9
|
+
::: condepe.condepe_localities
|
|
10
|
+
|
|
11
|
+
## Retrieve data
|
|
12
|
+
|
|
13
|
+
::: condepe.condepe_series
|
|
14
|
+
|
|
15
|
+
::: condepe.condepe_data
|
|
16
|
+
|
|
17
|
+
## Cache and settings
|
|
18
|
+
|
|
19
|
+
::: condepe.condepe_cache_dir
|
|
20
|
+
|
|
21
|
+
::: condepe.condepe_cache_clear
|
|
22
|
+
|
|
23
|
+
::: condepe.set_timeout
|
|
24
|
+
|
|
25
|
+
::: condepe.set_verbose
|
|
26
|
+
|
|
27
|
+
## Errors
|
|
28
|
+
|
|
29
|
+
::: condepe.CondepeError
|
|
30
|
+
|
|
31
|
+
::: condepe.HttpError
|
|
32
|
+
|
|
33
|
+
::: condepe.IntegrityError
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* Institutional blue of Pernambuco (#0C2856) with the cyan accent of the
|
|
2
|
+
official palette, as in the R package site. */
|
|
3
|
+
:root {
|
|
4
|
+
--md-primary-fg-color: #0c2856;
|
|
5
|
+
--md-primary-fg-color--light: #1f4f9a;
|
|
6
|
+
--md-primary-fg-color--dark: #06183a;
|
|
7
|
+
--md-accent-fg-color: #0068ff;
|
|
8
|
+
}
|
|
9
|
+
[data-md-color-scheme="slate"] {
|
|
10
|
+
--md-primary-fg-color: #0c2856;
|
|
11
|
+
--md-accent-fg-color: #00b7ff;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg viewBox="0 0 200 231" width="200" height="231" version="1.1" role="img"
|
|
3
|
+
aria-label="condepe for Python" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<title>condepe (Python)</title>
|
|
5
|
+
<!-- Hexagon in the institutional blue of Pernambuco (#0C2856); the motif is
|
|
6
|
+
the state outline (IBGE mesh, Fernando de Noronha left out) under a
|
|
7
|
+
time series, the two things the package delivers: places and series. -->
|
|
8
|
+
<defs>
|
|
9
|
+
<linearGradient id="fundo" x1="0" y1="0" x2="0" y2="1">
|
|
10
|
+
<stop offset="0" stop-color="#1f4f9a"/>
|
|
11
|
+
<stop offset="1" stop-color="#0c2856"/>
|
|
12
|
+
</linearGradient>
|
|
13
|
+
<linearGradient id="estado" x1="0" y1="0" x2="1" y2="0">
|
|
14
|
+
<stop offset="0" stop-color="#ffb000" stop-opacity="0.95"/>
|
|
15
|
+
<stop offset="1" stop-color="#ffce00" stop-opacity="0.95"/>
|
|
16
|
+
</linearGradient>
|
|
17
|
+
<clipPath id="hex"><polygon points="100,2 198,58.5 198,172.5 100,229 2,172.5 2,58.5"/></clipPath>
|
|
18
|
+
</defs>
|
|
19
|
+
<polygon points="100,2 198,58.5 198,172.5 100,229 2,172.5 2,58.5" fill="url(#fundo)"/>
|
|
20
|
+
<g clip-path="url(#hex)">
|
|
21
|
+
<line x1="30" y1="46" x2="170" y2="46" stroke="#ffffff" stroke-opacity="0.08" stroke-width="0.6"/>
|
|
22
|
+
<line x1="30" y1="62" x2="170" y2="62" stroke="#ffffff" stroke-opacity="0.08" stroke-width="0.6"/>
|
|
23
|
+
<line x1="30" y1="78" x2="170" y2="78" stroke="#ffffff" stroke-opacity="0.12" stroke-width="0.8"/>
|
|
24
|
+
<path d="M32.0,115.9 33.7,116.4 37.1,115.8 37.3,117.4 40.3,118.7 42.6,121.0 43.2,123.6 46.3,125.8 44.3,131.2 45.4,131.3 47.3,132.0 51.6,129.3 52.9,129.8 54.6,123.7 55.9,123.3 57.6,124.2 60.2,123.2 60.7,123.1 62.9,120.6 62.5,118.4 67.1,117.5 67.7,114.9 71.2,113.5 73.7,112.5 75.4,113.3 76.4,115.9 79.8,116.4 82.1,117.9 84.1,117.5 87.2,119.1 87.5,120.2 89.2,121.1 90.1,118.4 92.2,119.1 91.2,121.1 93.5,122.7 95.2,121.7 95.4,125.0 97.0,128.8 98.7,127.2 100.0,125.5 101.7,125.2 102.9,124.0 105.6,120.5 107.0,118.7 108.2,120.6 109.5,122.0 111.8,121.2 112.0,121.3 114.5,122.5 117.0,125.1 118.0,126.7 118.6,126.4 119.2,127.5 121.6,128.6 121.6,128.3 123.2,129.4 124.1,129.8 125.3,127.7 127.0,127.8 129.0,128.0 130.6,128.9 133.2,127.4 135.2,126.6 136.2,126.5 137.5,125.6 139.5,122.9 141.1,122.5 141.3,122.3 140.9,121.1 142.9,120.0 143.8,119.9 144.6,119.7 146.8,119.3 147.2,119.2 149.4,120.1 150.8,119.5 152.3,118.7 152.5,118.7 153.2,118.2 155.9,118.6 157.1,119.0 159.5,119.5 161.2,120.2 161.7,119.1 162.3,117.5 162.6,115.5 163.4,113.8 165.2,108.8 165.9,105.8 166.3,104.3 167.3,102.0 168.0,100.3 167.7,97.9 167.6,97.3 167.6,94.6 167.9,91.7 167.5,91.5 164.7,90.7 164.7,89.9 161.2,88.5 158.6,88.4 157.5,88.9 157.3,89.1 156.9,89.5 155.4,90.1 154.1,90.4 154.0,91.0 153.4,93.7 151.5,94.1 150.3,94.9 148.0,95.7 147.2,95.9 146.1,96.3 144.8,96.7 143.5,97.2 143.1,97.2 141.0,96.6 139.1,96.2 138.1,97.6 135.3,97.2 134.3,99.4 132.4,99.1 131.7,99.8 130.5,103.4 129.3,104.4 127.2,105.1 124.7,106.4 123.7,107.3 122.3,107.2 119.4,104.7 119.8,103.7 119.7,101.6 115.5,100.0 119.2,97.0 119.6,96.5 119.6,95.2 119.4,94.8 118.6,93.5 121.1,91.0 122.2,90.6 122.2,90.6 123.1,90.2 122.5,88.7 121.7,88.2 119.1,86.7 117.3,86.0 116.2,86.3 114.7,87.7 113.8,87.7 111.9,89.4 110.9,90.5 109.9,91.2 107.5,92.7 107.2,93.0 107.1,93.3 106.8,94.0 104.0,94.8 102.8,96.2 101.9,96.5 100.5,96.4 99.4,97.3 99.2,96.9 97.3,97.4 95.5,95.7 94.5,94.4 92.9,95.3 92.4,95.2 89.6,96.0 87.0,93.2 87.0,93.3 83.3,95.9 81.9,97.9 81.8,97.9 80.7,97.2 79.2,98.2 79.0,96.3 78.1,95.2 75.6,94.1 73.4,93.2 73.0,93.0 71.8,92.2 71.5,90.1 69.7,90.4 68.6,89.2 65.7,87.1 62.6,87.4 62.3,87.3 57.0,88.0 55.2,86.9 53.1,87.1 51.3,87.9 49.4,86.9 48.9,88.5 46.7,89.3 45.4,90.3 47.3,94.0 46.3,96.2 48.7,97.3 49.0,100.3 48.6,101.1 48.3,101.8 48.3,101.8 47.7,103.3 44.4,106.2 44.0,107.3 42.3,108.8 41.0,110.4 39.9,109.4 36.3,112.2 35.2,114.3Z" fill="url(#estado)" stroke="#ffffff" stroke-width="1.2" stroke-linejoin="round"/>
|
|
25
|
+
<polyline points="42,78 70,64 100,70 128,58 154,50" fill="none" stroke="#06183a" stroke-opacity="0.35" stroke-width="4"
|
|
26
|
+
stroke-linecap="round" stroke-linejoin="round" transform="translate(0,2)"/>
|
|
27
|
+
<polyline points="42,78 70,64 100,70 128,58 154,50" fill="none" stroke="#ffffff" stroke-width="2.5"
|
|
28
|
+
stroke-linecap="round" stroke-linejoin="round"/>
|
|
29
|
+
<circle cx="42" cy="78" r="4" fill="#ffffff"/>
|
|
30
|
+
<circle cx="42" cy="78" r="2" fill="#ffce00"/>
|
|
31
|
+
<circle cx="70" cy="64" r="4" fill="#ffffff"/>
|
|
32
|
+
<circle cx="70" cy="64" r="2" fill="#ffce00"/>
|
|
33
|
+
<circle cx="100" cy="70" r="4" fill="#ffffff"/>
|
|
34
|
+
<circle cx="100" cy="70" r="2" fill="#ffce00"/>
|
|
35
|
+
<circle cx="128" cy="58" r="4" fill="#ffffff"/>
|
|
36
|
+
<circle cx="128" cy="58" r="2" fill="#ffce00"/>
|
|
37
|
+
<circle cx="154" cy="50" r="4" fill="#ffffff"/>
|
|
38
|
+
<circle cx="154" cy="50" r="2" fill="#ffce00"/>
|
|
39
|
+
</g>
|
|
40
|
+
<polygon points="100,2 198,58.5 198,172.5 100,229 2,172.5 2,58.5" fill="none" stroke="#06183a" stroke-width="3"/>
|
|
41
|
+
<text x="100" y="164" text-anchor="middle"
|
|
42
|
+
font-family="'Fira Code', 'Courier New', monospace"
|
|
43
|
+
font-size="24px" font-weight="700" fill="#ffffff" letter-spacing="1">condepe</text>
|
|
44
|
+
<g transform="translate(100,190)">
|
|
45
|
+
<rect x="-17" y="-11" width="34" height="18" rx="9" fill="#ffce00"/>
|
|
46
|
+
<text x="0" y="3.5" text-anchor="middle" font-family="'Fira Code', 'Courier New', monospace"
|
|
47
|
+
font-size="12px" font-weight="700" fill="#0c2856">py</text>
|
|
48
|
+
</g>
|
|
49
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Worked examples
|
|
2
|
+
|
|
3
|
+
Plots use matplotlib, which is not a dependency of the package
|
|
4
|
+
(`pip install matplotlib`).
|
|
5
|
+
|
|
6
|
+
## Infant mortality in the largest cities
|
|
7
|
+
|
|
8
|
+
Deaths under one year per thousand live births, by municipality of
|
|
9
|
+
residence, for Recife, Jaboatão dos Guararapes, Caruaru and Petrolina:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
cidades = ["2611606", "2607901", "2604106", "2611101"]
|
|
13
|
+
|
|
14
|
+
tmi = condepe.condepe_series(
|
|
15
|
+
"datasus_mortalidade_infantil",
|
|
16
|
+
"Taxa de mortalidade infantil (por mil nascidos vivos)",
|
|
17
|
+
code=cidades,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
largo = tmi.pivot(index="ano", columns="nm_municipio", values="valor")
|
|
21
|
+
|
|
22
|
+
largo
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
nm_municipio Caruaru Jaboatão dos Guararapes Petrolina Recife
|
|
27
|
+
ano
|
|
28
|
+
2017 11.98 10.63 15.30 10.83
|
|
29
|
+
2018 10.73 12.08 15.20 10.53
|
|
30
|
+
2019 9.62 11.59 18.07 11.50
|
|
31
|
+
2020 9.74 12.19 14.02 11.20
|
|
32
|
+
2021 10.62 12.12 15.40 10.03
|
|
33
|
+
2022 13.17 13.96 14.86 10.93
|
|
34
|
+
2023 12.64 13.41 14.28 12.32
|
|
35
|
+
2024 11.35 13.87 16.36 11.85
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
ax = largo.plot(
|
|
42
|
+
marker="o",
|
|
43
|
+
color=["#0c2856", "#0068ff", "#00b7ff", "#ff6700"],
|
|
44
|
+
figsize=(7, 4),
|
|
45
|
+
title="Infant mortality",
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
ax.set_xlabel("")
|
|
49
|
+
|
|
50
|
+
ax.set_ylabel("per 1,000 live births")
|
|
51
|
+
|
|
52
|
+
print(fig("tmi"))
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
## Cargo at the port of Suape
|
|
58
|
+
|
|
59
|
+
Monthly gross cargo handled at Suape (Ipojuca), in million tonnes:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
suape = condepe.condepe_series("porto_suape_carga", "Porto de Suape - Carga bruta total")
|
|
63
|
+
|
|
64
|
+
suape["data"] = pd.to_datetime(dict(year=suape["ano"], month=suape["mes"], day=1))
|
|
65
|
+
|
|
66
|
+
ax = (suape.set_index("data")["valor"] / 1e6).plot(
|
|
67
|
+
color="#0c2856", figsize=(7, 4), title="Port of Suape, gross cargo"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
ax.set_xlabel("")
|
|
71
|
+
|
|
72
|
+
ax.set_ylabel("million t")
|
|
73
|
+
|
|
74
|
+
print(fig("suape"))
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## IDEB of the municipal schools
|
|
80
|
+
|
|
81
|
+
The Basic Education Development Index of the early years of elementary
|
|
82
|
+
school, municipal network, in Recife:
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
ideb = condepe.condepe_series(
|
|
86
|
+
"inep_ideb_anos_iniciais", "IDEB observado - Municipal", code="2611606"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
ideb[["ano", "valor"]]
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
ano valor
|
|
94
|
+
0 2005 3.2
|
|
95
|
+
1 2007 3.8
|
|
96
|
+
2 2009 4.1
|
|
97
|
+
3 2011 4.1
|
|
98
|
+
4 2013 4.2
|
|
99
|
+
5 2015 4.6
|
|
100
|
+
6 2017 5.0
|
|
101
|
+
7 2019 5.2
|
|
102
|
+
8 2021 5.3
|
|
103
|
+
9 2023 5.5
|
|
104
|
+
10 2025 5.8
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## All municipalities in one year
|
|
108
|
+
|
|
109
|
+
Live births by municipality of residence in 2024, the ten largest:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
nasc = condepe.condepe_series("datasus_sinasc", "Nascidos vivos por residência - Total", years=2024)
|
|
113
|
+
|
|
114
|
+
nasc.nlargest(10, "valor")[["nm_municipio", "valor"]]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
nm_municipio valor
|
|
119
|
+
131 Recife 16116.0
|
|
120
|
+
87 Jaboatão dos Guararapes 7284.0
|
|
121
|
+
125 Petrolina 6175.0
|
|
122
|
+
44 Caruaru 5285.0
|
|
123
|
+
110 Olinda 3879.0
|
|
124
|
+
121 Paulista 3284.0
|
|
125
|
+
30 Cabo de Santo Agostinho 2435.0
|
|
126
|
+
66 Garanhuns 1965.0
|
|
127
|
+
36 Camaragibe 1711.0
|
|
128
|
+
183 Vitória de Santo Antão 1622.0
|
|
129
|
+
```
|