A Python library for the IOM DTM API
Project description
PyDTM
pydtm
is a Python toolkit designed to interact with IOM's Displacement Tracking Matrix (DTM) API using the requests
package. The DTM API enables the humanitarian community, academia, media, government, and non-governmental organizations to access data collected by DTM. This data includes non-sensitive figures of internally displaced persons (IDPs), aggregated at various administrative levels.
Installation
pydtm
is available on PyPi. You can install it using pip:
pip install pydtm
Usage
Here's a basic example to get you started:
import pydtm
# Query country level data for Yemen from January 2000 to December 2023
from pydtm.api import countryLevelData
response_country = countryLevelData(admin0Pcode="YEM", monthFrom_month= "1", monthFrom_year=2000, monthTo_month= "12", monthTo_year=2023, to_pandas=True)
print(response_country)
# Query admin1 level data for Yemen from January 2000 to December 2023
from pydtm.api import admin1LevelData
response_admin1 = admin1LevelData(admin0Pcode="YEM", monthFrom_month= "1", monthFrom_year=2000, monthTo_month= "12", monthTo_year=2023, to_pandas=True)
print(response_admin1)
# Query admin2 level data for Yemen from January 2000 to December 2023
from pydtm.api import admin2LevelData
response_admin2 = admin2LevelData(admin0Pcode="YEM", monthFrom_month= "1", monthFrom_year=2000, monthTo_month= "12", monthTo_year=2023, to_pandas=True)
print(response_admin2)
Documentation
pydtm
's documentation is available on readthedocs.org.
Contribution Guidelines
We welcome contributions! Please follow these guidelines to contribute:
- Fork the Repository: Click the "Fork" button at the top right of this page to create a copy of this repository on your GitHub account.
- Clone the Forked Repository: Clone your forked repository to your local machine.
git clone https://github.com/yourusername/pydtm.git cd pydtm
- Create a New Branch: Create a new branch for your feature or bug fix.
git checkout -b feature-name
- Make Your Changes: Implement your feature or bug fix.
- Add Docstrings: Ensure all functions and classes have docstrings following the Sphinx-RTD format.
- Update Documentation: Add new functions and classes to the documentation by editing
docs/source/pydtm.rst
using Sphinx autodoc directives. - Write Tests: Ensure your new code is tested with
unittest
.- If you add a function to an existing file, add corresponding tests to the related file in the
tests/
folder. - If you create a new file, create a corresponding test file in the
tests/
folder, with a class inheriting fromunittest.TestCase
.
- If you add a function to an existing file, add corresponding tests to the related file in the
- Commit and Push Your Changes: Commit your changes and push to your forked repository.
git add . git commit -m "Description of your changes" git push origin feature-name
- Create a Pull Request: Go to the original repository on GitHub and create a pull request from your forked repository. Please ensure your pull request is against the
dev
branch.
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pydtm-0.0.10.tar.gz
.
File metadata
- Download URL: pydtm-0.0.10.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc579182cf90ab5dabfbac7cafd9e25955a6dedd41866ca83e1c1badbacedcac |
|
MD5 | 457a75aa15970f493a52db5202271a5c |
|
BLAKE2b-256 | 558debc6a99379da74af82748265c68ca389dddceb8a41d5cc16a25f3a7b8166 |
File details
Details for the file pydtm-0.0.10-py3-none-any.whl
.
File metadata
- Download URL: pydtm-0.0.10-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88e4d4f22e1d203711aad009e391ad723b9cc52d4fa78b8aaa4b78151aebde3c |
|
MD5 | 3a8fceba09570cc84ddcf0889e309fdf |
|
BLAKE2b-256 | f7da6473cd72bb44f8151a431f591d300022799ae78e61508e412df848bad41c |