Name | zim-id JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Zim-ID is a Python library/API for validating, debugging, and generating Zimbabwean national ID numbers. |
upload_time | 2025-08-10 11:58:15 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT License
Copyright (c) 2025 Haripo Wesley T.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
|
keywords |
zimbabwe
national
id
numbers
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Zim-ID
Zim-ID is a Python library/API for validating, debugging, and generating Zimbabwean national ID numbers. It solves the bug in the [zwe](https://github.com/identique/idnumbers/tree/main/idnumbers/nationalid/zwe) module of the [idnumbers](https://github.com/identique/idnumbers) library where the **Modulus 23** algorithm was incorrectly implemented. The project has since been archived and is no longer maintained hence we couldn't contribute to fix the issue.
## Background
A valid Zimbabwean national ID number is one in the format `##-######L##` where:
- the **first two digits** represent the district code of the **registration office**,
- the **hyphen** is for formatting purposes,
- the **middle 6 or 7 digits** represent the sequential **national number**,
- the **alphabetical letter** represents the cryptographic **check letter**, and
- the **last two digits** represent the district code of the **district of origin**.
A check letter is one of 23 letters (26 of the English alphabet excluding I, O, and U) which is calculated as the letter at the index gotten by finding the remainder of dividing the resulting number from combining the registration office code and the national number by **23**. Hence the name **Modulus 23**.
## Installation
```bash
pip install zim_id
```
## Usage
### Validating ID numbers
This is a process of checking whether a given ID number is a valid Zimbabwean national ID number.
```python
ZimID.validate(id_number: str) -> bool:
````
#### Example Usage
```python
>>> from zim_id import ZimID
>>> id_number = "50-2001148W50"
>>> ZimID.validate(id_number)
>>> True
```
### Debugging ID numbers
This is a process of not only checking if a given ID number is a valid Zimbabwean national ID number, but also determining what's making it invalid. The debug method returns one of 6 integer flags:
```python
ZimID.debug(id_number: str) -> int:
```
| Flag | Meaning |
|------|-----------------------------------------------|
| 0 | ID number is valid |
| 1 | ID number is incorrectly formatted |
| 2 | ID number has unkown registration office code |
| 3 | ID number has unkown check letter |
| 4 | ID number has unkown district of origin |
| 5 | ID number has invalid check sum |
#### Example
```python
>>> from zim_id import ZimID
>>> id_number = "50-2001148W50"
>>> ZimID.debug(id_number)
>>> 0
```
### Generating ID numbers
This is a process of generating random or custom valid Zimbabwean national ID numbers. The national number is always random although one can specify a custom registration office or district of origin.
> THE ID GENERATION FEATURE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE FEATURE OR ITS USE.
```python
ZimID.generate(reg_office: str | None, origin_district: str | None) -> str:
```
#### Example
```python
>>> from zim_id import ZimID
>>> ZimID.generate(None, None) # random reg_office, random origin_district
>>> '06-1522349S21'
>>> ZimID.generate("63", None) # custom reg_office, random origin_district
>>> '63-8158549W19'
>>> ZimID.generate(None, "08") # random reg_office, custom origin_district
>>> '07-8870909Y08'
>>> ZimID.generate("50", "50") # custom reg_office, custom origin_district
>>> '50-9924604Y50'
```
## Appendix
### District Codes
| District | Code |
|-----------------------------------|------|
| Beitbridge | 02 |
| Mberengwa | 03 |
| Bikita | 04 |
| Bindura | 05 |
| Binga | 06 |
| Buhera | 07 |
| Bulawayo | 08 |
| Mhondoro-Ngezi | 10 |
| Muzarabani | 11 |
| Chipinge | 13 |
| Chiredzi | 14 |
| Mazowe | 15 |
| Chikomba | 18 |
| Umzingwane | 19 |
| Insiza | 21 |
| Masvingo | 22 |
| Gokwe South | 23 |
| Kadoma | 24 |
| Goromonzi | 25 |
| Gokwe North | 26 |
| Gutu | 27 |
| Gwanda | 28 |
| Gweru | 29 |
| Chegutu | 32 |
| Nyanga | 34 |
| Bubi | 35 |
| Kariba | 37 |
| Hurungwe | 38 |
| Matobo | 39 |
| Lupane | 41 |
| Makoni | 42 |
| Marondera | 43 |
| Chimanimani | 44 |
| Mt. Darwin | 45 |
| Mbire | 46 |
| Murehwa | 47 |
| Mutoko | 48 |
| Mudzi | 49 |
| Mutasa | 50 |
| Nkayi | 53 |
| Mwenenzi | 54 |
| Bulilimamangwe | 56 |
| Kwekwe | 58 |
| Seke | 59 |
| Rushinga | 61 |
| Harare | 63 |
| Shurugwi | 66 |
| Zvishavane | 67 |
| Shamva | 68 |
| Makonde | 70 |
| Guruve | 71 |
| Tsholotsho | 73 |
| Mutare | 75 |
| Chirumanzu | 77 |
| Hwange | 79 |
| Hwedza | 80 |
| Zaka | 83 |
| Umguza | 84 |
| U.M.P. (Uzumba, Maramba, Pfungwe) | 85 |
| Zvimba | 86 |
**Note:** 00 is a valid district code of origin for foreigners.
## License
This project is licensed under the **MIT License** – see the [LICENSE](https://raw.githubusercontent.com/haripowesleyt/zim-id/main/LICENSE) file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "zim-id",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "\"Haripo Wesley T.\" <haripowesleyt@proton.me>",
"keywords": "zimbabwe national id numbers",
"author": null,
"author_email": "\"Haripo Wesley T.\" <haripowesleyt@proton.me>",
"download_url": "https://files.pythonhosted.org/packages/09/1e/3306b056bb2265d9f379100ad42631658322720b72e52227e2a31ac3327c/zim_id-0.1.0.tar.gz",
"platform": null,
"description": "# Zim-ID\n\nZim-ID is a Python library/API for validating, debugging, and generating Zimbabwean national ID numbers. It solves the bug in the [zwe](https://github.com/identique/idnumbers/tree/main/idnumbers/nationalid/zwe) module of the [idnumbers](https://github.com/identique/idnumbers) library where the **Modulus 23** algorithm was incorrectly implemented. The project has since been archived and is no longer maintained hence we couldn't contribute to fix the issue.\n\n## Background\nA valid Zimbabwean national ID number is one in the format `##-######L##` where:\n- the **first two digits** represent the district code of the **registration office**,\n- the **hyphen** is for formatting purposes,\n- the **middle 6 or 7 digits** represent the sequential **national number**,\n- the **alphabetical letter** represents the cryptographic **check letter**, and\n- the **last two digits** represent the district code of the **district of origin**.\n\nA check letter is one of 23 letters (26 of the English alphabet excluding I, O, and U) which is calculated as the letter at the index gotten by finding the remainder of dividing the resulting number from combining the registration office code and the national number by **23**. Hence the name **Modulus 23**.\n\n## Installation\n\n```bash\npip install zim_id\n```\n\n## Usage\n\n### Validating ID numbers\n\nThis is a process of checking whether a given ID number is a valid Zimbabwean national ID number.\n\n```python\nZimID.validate(id_number: str) -> bool:\n````\n\n#### Example Usage\n\n```python\n>>> from zim_id import ZimID\n>>> id_number = \"50-2001148W50\"\n>>> ZimID.validate(id_number)\n>>> True\n```\n\n### Debugging ID numbers\n\nThis is a process of not only checking if a given ID number is a valid Zimbabwean national ID number, but also determining what's making it invalid. The debug method returns one of 6 integer flags:\n\n```python\nZimID.debug(id_number: str) -> int:\n```\n\n| Flag | Meaning |\n|------|-----------------------------------------------|\n| 0 | ID number is valid |\n| 1 | ID number is incorrectly formatted |\n| 2 | ID number has unkown registration office code |\n| 3 | ID number has unkown check letter |\n| 4 | ID number has unkown district of origin |\n| 5 | ID number has invalid check sum |\n\n#### Example\n\n```python\n>>> from zim_id import ZimID\n>>> id_number = \"50-2001148W50\"\n>>> ZimID.debug(id_number)\n>>> 0\n```\n\n### Generating ID numbers\n\nThis is a process of generating random or custom valid Zimbabwean national ID numbers. The national number is always random although one can specify a custom registration office or district of origin.\n\n> THE ID GENERATION FEATURE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE FEATURE OR ITS USE.\n\n```python\nZimID.generate(reg_office: str | None, origin_district: str | None) -> str:\n```\n\n#### Example\n\n```python\n>>> from zim_id import ZimID\n\n>>> ZimID.generate(None, None) # random reg_office, random origin_district\n>>> '06-1522349S21'\n\n>>> ZimID.generate(\"63\", None) # custom reg_office, random origin_district\n>>> '63-8158549W19'\n\n>>> ZimID.generate(None, \"08\") # random reg_office, custom origin_district\n>>> '07-8870909Y08'\n\n>>> ZimID.generate(\"50\", \"50\") # custom reg_office, custom origin_district\n>>> '50-9924604Y50'\n```\n\n## Appendix\n\n### District Codes\n\n| District | Code |\n|-----------------------------------|------|\n| Beitbridge | 02 |\n| Mberengwa | 03 |\n| Bikita | 04 |\n| Bindura | 05 |\n| Binga | 06 |\n| Buhera | 07 |\n| Bulawayo | 08 |\n| Mhondoro-Ngezi | 10 |\n| Muzarabani | 11 |\n| Chipinge | 13 |\n| Chiredzi | 14 |\n| Mazowe | 15 |\n| Chikomba | 18 |\n| Umzingwane | 19 |\n| Insiza | 21 |\n| Masvingo | 22 |\n| Gokwe South | 23 |\n| Kadoma | 24 |\n| Goromonzi | 25 |\n| Gokwe North | 26 |\n| Gutu | 27 |\n| Gwanda | 28 |\n| Gweru | 29 |\n| Chegutu | 32 |\n| Nyanga | 34 |\n| Bubi | 35 |\n| Kariba | 37 |\n| Hurungwe | 38 |\n| Matobo | 39 |\n| Lupane | 41 |\n| Makoni | 42 |\n| Marondera | 43 |\n| Chimanimani | 44 |\n| Mt. Darwin | 45 |\n| Mbire | 46 |\n| Murehwa | 47 |\n| Mutoko | 48 |\n| Mudzi | 49 |\n| Mutasa | 50 |\n| Nkayi | 53 |\n| Mwenenzi | 54 |\n| Bulilimamangwe | 56 |\n| Kwekwe | 58 |\n| Seke | 59 |\n| Rushinga | 61 |\n| Harare | 63 |\n| Shurugwi | 66 |\n| Zvishavane | 67 |\n| Shamva | 68 |\n| Makonde | 70 |\n| Guruve | 71 |\n| Tsholotsho | 73 |\n| Mutare | 75 |\n| Chirumanzu | 77 |\n| Hwange | 79 |\n| Hwedza | 80 |\n| Zaka | 83 |\n| Umguza | 84 |\n| U.M.P. (Uzumba, Maramba, Pfungwe) | 85 |\n| Zvimba | 86 |\n\n**Note:** 00 is a valid district code of origin for foreigners.\n\n## License\nThis project is licensed under the **MIT License** \u2013 see the [LICENSE](https://raw.githubusercontent.com/haripowesleyt/zim-id/main/LICENSE) file for details.\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2025 Haripo Wesley T.\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "Zim-ID is a Python library/API for validating, debugging, and generating Zimbabwean national ID numbers.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/haripowesleyt/zim-id",
"Issues": "https://github.com/haripowesleyt/zim-id/issues",
"Repository": "https://github.com/haripowesleyt/zim-id"
},
"split_keywords": [
"zimbabwe",
"national",
"id",
"numbers"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d49cd5df71e3bb2283a882330855f9145191a93a93654d38eb407510dcb2d69e",
"md5": "966985bb20e8e92a9be834b8f002d2d4",
"sha256": "f7dbf0025e767ccafc98f939e7ee827894e5e3ea9d7d3d8751b76dec45242449"
},
"downloads": -1,
"filename": "zim_id-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "966985bb20e8e92a9be834b8f002d2d4",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6439,
"upload_time": "2025-08-10T11:58:13",
"upload_time_iso_8601": "2025-08-10T11:58:13.568586Z",
"url": "https://files.pythonhosted.org/packages/d4/9c/d5df71e3bb2283a882330855f9145191a93a93654d38eb407510dcb2d69e/zim_id-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "091e3306b056bb2265d9f379100ad42631658322720b72e52227e2a31ac3327c",
"md5": "17bccc10a3e089222894fe188e8cb3b7",
"sha256": "3fc1d16bad553ad5405d3cfb1604a9151b309713d6ea4e46f60ca2091eac3265"
},
"downloads": -1,
"filename": "zim_id-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "17bccc10a3e089222894fe188e8cb3b7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6257,
"upload_time": "2025-08-10T11:58:15",
"upload_time_iso_8601": "2025-08-10T11:58:15.561191Z",
"url": "https://files.pythonhosted.org/packages/09/1e/3306b056bb2265d9f379100ad42631658322720b72e52227e2a31ac3327c/zim_id-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-10 11:58:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "haripowesleyt",
"github_project": "zim-id",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "zim-id"
}