Logo Lanfrica

oswelloz/Validate-a-South-African-ID-Python-

Domaine:

digital infrastructure

Type de record:

software
Créateur:
osw
Hôte:
# Overview This project provides a set of functions to validate South African ID numbers. It checks for correct length, valid date of birth, gender codes, citizenship status, and the Luhn checksum. # Features ## The project validates South African ID numbers against a set of rules - Validates the length of the ID number - Check if a string of digits is being passed - Check for valid date of birth - Validate citizenship status - Perform Luhn algorithm checksum verification # Requirements - Python 3.x - pytest for running tests ## Installation To use this project, clone the repository and install the required packages: 1. Clone Repository: - For HTTPS: ```bash git clone github.com ``` - For SSH KEY: ```bash git clone git@github.com:Umuzi-org/Oswell-Ndhlovu-625-validate-a-south-african-id-number-python.git ``` 2. Navigate into the project directory: ```bash cd Oswell-Ndhlovu-625-validate-a-south-african-id-number-python ``` 3. Set up a virtual environment: ```bash python -m venv {virtual_environment_name} ``` Replace {virtual_environment_name} with your prefered name. 4. Activate the virtual environment: - On Windows: ```bash {virtual_environment_name}\Scripts\activate ``` - On macOS/Linux: ```bash source {virtual_environment_name}/bin/activate ``` 5. Install requirements: This will install pytest. ```bash pip install -r requirements.txt ``` # Usage You can use the following functions in the code: `def is_id_number_string(id_number: str):` - Returns False if id_number is not a string `de validate_length(id_number:str)` - Checks if the length on the id_number is equal to 13 `def is_id_number_digits_only(id_number):` - Returns True if the id_number is digits only `def validate_date_of_birth(id_number:str):` validates that the id_number has the correct date of birth format. `def validate_citizenship(id_number:str):` - Checks for the correct citizenship code. ` def validate_gen …