Python library for Polish eKW (Land Registry)
Project description
pyekw - Polish eKW (Land Registry) Utilities
A Python library for working with Polish eKW (Elektroniczne Księgi Wieczyste) land registry numbers.
Features
- KW Number Validation: Validate complete KW numbers including court codes and check digits
- Check Digit Generation: Calculate correct check digits for court codes and register numbers
- Court Registry: Comprehensive database of Polish courts handling land registry matters
- Utility Functions: Normalize, extract, and analyze KW numbers from various sources
Installation
uv add "git+https://github.com/mhajder/pyekw.git"
Quick Start
from pyekw import KWValidator, CheckDigitGenerator, CourtRegistry, KWUtils
# Validate a KW number
validator = KWValidator()
is_valid, error = validator.validate_kw_number("WA4M/00123456/4")
print(f"Valid: {is_valid}") # True
# Generate check digit
generator = CheckDigitGenerator()
check_digit = generator.calculate_check_digit("WA4M", "00123456")
print(f"Check digit: {check_digit}") # 4
# Work with court registry
registry = CourtRegistry()
court_name = registry.get_court_name("WA4M")
print(f"Court: {court_name}") # WARSZAWA
# Utility functions
utils = KWUtils()
normalized = utils.normalize_kw_number(" wa4m / 00123456 / 4 ")
print(f"Normalized: {normalized}") # WA4M/00123456/4
API Documentation
KWValidator
Class for validating Polish KW numbers.
Methods:
-
validate_kw_number(kw_number: str) -> Tuple[bool, Optional[str]]
Validates a complete KW number.
Returns:(is_valid, error_message) -
parse_kw_number(kw_number: str) -> Tuple[str, str, str]
Parses a KW number into its components: court code, register number, check digit. -
validate_court_code(court_code: str) -> bool
Checks if the court code is valid. -
validate_check_digit(court_code: str, register_number: str, check_digit: str) -> bool
Validates the check digit for given court code and register number.
CheckDigitGenerator
Class for generating check digits and full KW numbers.
Methods:
-
calculate_check_digit(court_code: str, register_number: str) -> int
Calculates the check digit for a given court code and register number. -
generate_full_kw_number(court_code: str, register_number: str) -> str
Generates a complete KW number with the correct check digit.
CourtRegistry
Class for working with the court database.
Methods:
-
is_valid_court(court_code: str) -> bool
Checks if a court code exists in the registry. -
get_court_name(court_code: str) -> str
Returns the name of the court for a given code. -
search_courts(query: str) -> List[Dict]
Searches courts by name or code. -
get_all_courts() -> Dict[str, str]
Returns a dictionary of all court codes and names.
KWUtils
Utility class for working with KW numbers.
Methods:
-
normalize_kw_number(kw_number: str) -> str
Normalizes the format of a KW number. -
extract_kw_numbers(text: str) -> List[str]
Extracts all KW numbers from a given text. -
get_kw_info(kw_number: str) -> Dict
Returns detailed information about a KW number. -
generate_kw_number_variants(court_code: str, start_number: int, count: int) -> List[str]
Generates a series of KW numbers. -
validate_multiple_kw_numbers(kw_numbers: List[str]) -> List[Tuple[str, bool, Optional[str]]]
Validates multiple KW numbers at once. -
suggest_corrections(kw_number: str) -> List[str]
Suggests possible corrections for an invalid KW number.
Examples
You can find example usage of all main functions and classes in the examples/ directory.
examples/example_all_functions.py: Demonstrates validation, parsing, check digit generation, court registry operations, and utility functions.
To run the example:
python examples/example_all_functions.py
Feel free to explore and modify the example to fit your use case.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License.
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 pyekw-0.2.0.tar.gz.
File metadata
- Download URL: pyekw-0.2.0.tar.gz
- Upload date:
- Size: 116.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f63cd609683dcf31fef0b06e7f2c3f2ec406a3512658f3c7ed870aa27473105
|
|
| MD5 |
1b2938d83f1273dc71571dc1519868d1
|
|
| BLAKE2b-256 |
debdd8c4a2b788796db60ba2486912072c074532c74f22a5c2af4cbd80a0433f
|
Provenance
The following attestation bundles were made for pyekw-0.2.0.tar.gz:
Publisher:
publish.yml on mhajder/pyekw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyekw-0.2.0.tar.gz -
Subject digest:
3f63cd609683dcf31fef0b06e7f2c3f2ec406a3512658f3c7ed870aa27473105 - Sigstore transparency entry: 771487278
- Sigstore integration time:
-
Permalink:
mhajder/pyekw@c9f19454e65149e72cda65e9cb50167cb7d845f3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mhajder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9f19454e65149e72cda65e9cb50167cb7d845f3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyekw-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyekw-0.2.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cfdae8f779fde8937983f57e486bbeec4790cfb31d0a3197429e47453d03989
|
|
| MD5 |
413633b0832b404ea7c845cd23e79f1e
|
|
| BLAKE2b-256 |
a3c1f0280b0ce84391b0bbb3252450ff0100130a46e72b474ad0a751ccc8f293
|
Provenance
The following attestation bundles were made for pyekw-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on mhajder/pyekw
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyekw-0.2.0-py3-none-any.whl -
Subject digest:
9cfdae8f779fde8937983f57e486bbeec4790cfb31d0a3197429e47453d03989 - Sigstore transparency entry: 771487282
- Sigstore integration time:
-
Permalink:
mhajder/pyekw@c9f19454e65149e72cda65e9cb50167cb7d845f3 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/mhajder
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c9f19454e65149e72cda65e9cb50167cb7d845f3 -
Trigger Event:
push
-
Statement type: