Funções de utilidade para Moçambique. Validação de NUIT, documentos e formatação de telefones.
Project description
moz-utils
Python (Django/FastAPI)
The digital foundation of Mozambican identity. The definitive Swiss army knife for validations, postal codes, and financial ecosystems in Mozambique, natively ported to the Python ecosystem.
📜 The Vision
In Mozambique, digital accuracy is the foundation of the future. From the pulse of mobile wallets in the squares to the rigorous structure of the National ID (BI), moz-utils exists to ensure that every piece of data that crosses your backend (Django, Flask, FastAPI) or Data Science script is validated, structured, and authentic.
Built impeccably for the Python ecosystem, this package is more than a library — it is the open-source validation infrastructure our country deserves. Clean code, tested, and poetically engineered for Mozambique.
📦 Installation
Install using pip:
pip install moz-utils
Or using poetry:
poetry add moz-utils
🚀 API Reference Guide
1. Documents and Citizen Identity
from moz_utils import (
is_valid_bi,
is_valid_nuit,
get_nuit_entity_type,
is_valid_dire,
is_valid_passport,
is_valid_driving_license
)
# National ID (12 digits + 1 letter)
is_valid_bi("110101234567A") # True
# NUIT - Unique Tax Identification Number
is_valid_nuit("123456789") # True
get_nuit_entity_type("400000006") # "Collective (Quotas Companies...)"
# DIRE - Foreign Resident Identification Document
is_valid_dire("00008312C") # True
# Passport and Driving License
is_valid_passport("AO1234567") # True
is_valid_driving_license("M123456") # True
2. Financial Ecosystem and Telecommunications
Deep mapping of the Mozambican digital circulatory system — identifies operators and the pulse of associated mobile wallets.
from moz_utils import (
is_valid_mozambican_phone,
format_mozambican_phone,
get_mobile_operator,
get_mobile_wallet,
build_whatsapp_url
)
# Validation and Formatting
is_valid_mozambican_phone("841234567") # True
format_mozambican_phone("841234567") # "+258 84 123 4567"
# Telecom and Financial Intelligence
get_mobile_operator("841234567") # "Vodacom"
get_mobile_wallet("841234567") # "M-Pesa"
get_mobile_wallet("821234567") # "mKesh"
get_mobile_wallet("861234567") # "e-Mola"
# Social Connections
build_whatsapp_url("841234567", "Hello, Mozambique!")
# "https://wa.me/258841234567?text=Hello%2C%20Mozambique%21"
3. Postal Codes (Legacy and New CEP)
A graceful transition between the past and the future: from the old post office stations to the geo-referenced New CEP.
from moz_utils import (
is_valid_new_cep,
suggest_ceps,
is_valid_postal_code,
get_postal_code_locality
)
# The Future (New CEP: Province, District, and Locality)
is_valid_new_cep("0101-01") # True
# Intelligent Suggestion Engine (Supports Legacy -> New Transition)
# Search by the old code "3100" (Nampula HQ) or by a neighborhood
suggest_ceps("3100")
suggest_ceps("Malhangalene")
# The Legacy
is_valid_postal_code("1100") # True
get_postal_code_locality("1100") # "Maputo ECP (HQ)"
4. National Geography and Finances
from moz_utils import (
format_mzn,
get_mozambique_provinces,
get_districts_by_province
)
# Monumental Value
format_mzn(1250.5) # "1 250,50 MT"
# Full Geography
provinces = get_mozambique_provinces()
nampula_districts = get_districts_by_province("npl")
🤝 Rules of Conduct and Contribution
This is not just any project. It is a project of national pride. We ask for excellence in code, compassion with colleagues, and the ambition to make the Mozambican web world-class. Read our CODE_OF_CONDUCT.md in the project root.
📄 License
The code lives and breathes the freedom of Open Source. Licensed under AGPL-3.0-or-later.
Developed by Open Source Contributors & supported by Edmilson Muacigarro
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moz_utils-0.3.1.tar.gz.
File metadata
- Download URL: moz_utils-0.3.1.tar.gz
- Upload date:
- Size: 35.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f2ca2d09384ae3ea3e0009a51fcf348a4330e72d70c85be0770b819e0a58604
|
|
| MD5 |
f7fe92e1283e8cc9b7eb51cfd9cd8a1d
|
|
| BLAKE2b-256 |
4cc2906b1638175ddf3ed7caddd92effd0cee64466fd4ce5619c352e11d55a5f
|
File details
Details for the file moz_utils-0.3.1-py3-none-any.whl.
File metadata
- Download URL: moz_utils-0.3.1-py3-none-any.whl
- Upload date:
- Size: 34.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
136541e0f1606f90cf3141d67930b10e292b65da1db6cd0618fb6bc14e2622f5
|
|
| MD5 |
955908837dd7f5f9373491629c6655d4
|
|
| BLAKE2b-256 |
2957cc064cca0024aa949c8e8388fe64ecb1241744decfba5c8850059079142e
|