zeolite 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. zeolite-0.1.0/.cursor/rules/library.mdc +39 -0
  2. zeolite-0.1.0/.cursor/rules/uv.mdc +103 -0
  3. zeolite-0.1.0/.github/release-template.md +17 -0
  4. zeolite-0.1.0/.github/workflows/prerelease.yml +61 -0
  5. zeolite-0.1.0/.github/workflows/publish-pypi.yml +65 -0
  6. zeolite-0.1.0/.github/workflows/release.yml +99 -0
  7. zeolite-0.1.0/.gitignore +166 -0
  8. zeolite-0.1.0/CHANGELOG.md +32 -0
  9. zeolite-0.1.0/PKG-INFO +71 -0
  10. zeolite-0.1.0/README.md +59 -0
  11. zeolite-0.1.0/docs/Sensitivity.md +44 -0
  12. zeolite-0.1.0/docs/release.md +106 -0
  13. zeolite-0.1.0/examples/basic/__init__.py +88 -0
  14. zeolite-0.1.0/pyproject.toml +23 -0
  15. zeolite-0.1.0/src/zeolite/__init__.py +177 -0
  16. zeolite-0.1.0/src/zeolite/_types/__init__.py +47 -0
  17. zeolite-0.1.0/src/zeolite/_types/data_type.py +15 -0
  18. zeolite-0.1.0/src/zeolite/_types/error.py +77 -0
  19. zeolite-0.1.0/src/zeolite/_types/graph.py +22 -0
  20. zeolite-0.1.0/src/zeolite/_types/sensitivity.py +11 -0
  21. zeolite-0.1.0/src/zeolite/_types/validation/__init__.py +0 -0
  22. zeolite-0.1.0/src/zeolite/_types/validation/threshold.py +115 -0
  23. zeolite-0.1.0/src/zeolite/_types/validation/validation_rule.py +78 -0
  24. zeolite-0.1.0/src/zeolite/_utils/__init__.py +1 -0
  25. zeolite-0.1.0/src/zeolite/_utils/args.py +11 -0
  26. zeolite-0.1.0/src/zeolite/_utils/calc_age.py +51 -0
  27. zeolite-0.1.0/src/zeolite/_utils/column_id.py +59 -0
  28. zeolite-0.1.0/src/zeolite/_utils/financial_years.py +35 -0
  29. zeolite-0.1.0/src/zeolite/_utils/parse_dates.py +87 -0
  30. zeolite-0.1.0/src/zeolite/_utils/sanitize.py +231 -0
  31. zeolite-0.1.0/src/zeolite/column/__init__.py +0 -0
  32. zeolite-0.1.0/src/zeolite/column/_clean/__init__.py +267 -0
  33. zeolite-0.1.0/src/zeolite/column/_utils/__init__.py +0 -0
  34. zeolite-0.1.0/src/zeolite/column/_utils/col_base.py +295 -0
  35. zeolite-0.1.0/src/zeolite/column/_utils/reference.py +225 -0
  36. zeolite-0.1.0/src/zeolite/column/_validation/__init__.py +173 -0
  37. zeolite-0.1.0/src/zeolite/column/_validation/check_base.py +123 -0
  38. zeolite-0.1.0/src/zeolite/column/_validation/data_checks.py +98 -0
  39. zeolite-0.1.0/src/zeolite/column/_validation/validation_node.py +93 -0
  40. zeolite-0.1.0/src/zeolite/column/checks.py +15 -0
  41. zeolite-0.1.0/src/zeolite/column/col.py +249 -0
  42. zeolite-0.1.0/src/zeolite/column/ref.py +92 -0
  43. zeolite-0.1.0/src/zeolite/py.typed +0 -0
  44. zeolite-0.1.0/src/zeolite/registry/__init__.py +121 -0
  45. zeolite-0.1.0/src/zeolite/registry/lineage.py +30 -0
  46. zeolite-0.1.0/src/zeolite/registry/optimise_calc_stages.py +85 -0
  47. zeolite-0.1.0/src/zeolite/registry/verify_registry.py +76 -0
  48. zeolite-0.1.0/src/zeolite/schema/__init__.py +7 -0
  49. zeolite-0.1.0/src/zeolite/schema/_table.py +209 -0
  50. zeolite-0.1.0/src/zeolite/schema/_utils/__init__.py +0 -0
  51. zeolite-0.1.0/src/zeolite/schema/_utils/normalise.py +227 -0
  52. zeolite-0.1.0/tests/conftest.py +52 -0
  53. zeolite-0.1.0/tests/unit/registry/test_registry.py +371 -0
  54. zeolite-0.1.0/uv.lock +224 -0
@@ -0,0 +1,39 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+ You are an expert in data analysis, data engineering pipelines, and Python library development.
7
+
8
+ Dependencies:
9
+ - polars
10
+
11
+
12
+ Key Principles:
13
+ - Write concise, technical responses with accurate Python examples.
14
+ - Prioritize readability and reproducibility in data analysis workflows.
15
+ - Use functional programming where appropriate; avoid unnecessary classes.
16
+ - Use type hints for all function signatures.
17
+ - Where possible, use dataclasses, TypedDicts, or Pydantic models for input validation and structured output/function returns.
18
+ - Use descriptive variable names that reflect the data they contain.
19
+ - Follow PEP 8 style guidelines for Python code.
20
+
21
+ Data Analysis and Manipulation:
22
+ - Use Polars for data manipulation and analysis.
23
+ - Use polars' lazy evaluation to optimize performance and memory usage.
24
+ - Avoid using pandas unless absolutely necessary.
25
+ - Prefer method chaining for data transformations when possible.
26
+
27
+ Error Handling and Data Validation:
28
+ - Handle missing data appropriately (imputation, removal, or flagging).
29
+ - Use try-except blocks for error-prone operations, especially when reading external data.
30
+ - Validate data types and ranges to ensure data integrity.
31
+
32
+
33
+ Performance Optimization:
34
+ - Use vectorized operations and lazy evaluation in polars for improved performance.
35
+ - Utilize efficient data structures (e.g., categorical data types for low-cardinality string columns).
36
+ - Consider using dask for larger-than-memory datasets.
37
+ - Profile code to identify and optimize bottlenecks.
38
+
39
+ Refer to the official documentation of polars for best practices and up-to-date APIs.
@@ -0,0 +1,103 @@
1
+ ---
2
+ description: Working with Python package management, using UV as the package manager, and running Python, pip, or UV-related CLI commands
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # UV Command Rules
7
+
8
+ ## General Rules
9
+ - Always use `uv` commands instead of `uv pip` commands
10
+ - Use `uv sync` instead of `uv pip install`
11
+ - Use `uv run` instead of direct command execution
12
+ - Use `uv add` instead of `uv pip install` for adding dependencies
13
+
14
+ ## Common Commands
15
+
16
+ ### Project Setup
17
+ ```bash
18
+ # Initialize a new project
19
+ uv init
20
+
21
+ # Install all dependencies
22
+ uv sync
23
+
24
+ # Install with dev dependencies
25
+ uv sync --dev
26
+
27
+ # Install with specific extras
28
+ uv sync --extras dev,test
29
+ ```
30
+
31
+ ### Dependency Management
32
+ ```bash
33
+ # Add a new dependency
34
+ uv add polars
35
+
36
+ # Add a development dependency
37
+ uv add --dev pytest
38
+
39
+ # Add a dependency with version constraint
40
+ uv add "polars>=1.24.0"
41
+
42
+ # Remove a dependency
43
+ uv remove polars
44
+
45
+ # Update dependencies
46
+ uv sync
47
+ ```
48
+
49
+ ### Running Commands
50
+ ```bash
51
+ # Run tests
52
+ uv run pytest
53
+
54
+ # Run with specific Python version
55
+ uv run --python 3.11 pytest
56
+
57
+ # Run with all extras
58
+ uv run --all-extras pytest
59
+ ```
60
+
61
+ ### Building and Publishing
62
+ ```bash
63
+ # Build the package
64
+ uv build
65
+
66
+ # Publish to PyPI
67
+ uv publish
68
+ ```
69
+
70
+ ### Environment Management
71
+ ```bash
72
+ # Create a virtual environment
73
+ uv venv
74
+
75
+ # List installed packages
76
+ uv tree
77
+
78
+ # Export requirements
79
+ uv export requirements.txt
80
+ ```
81
+
82
+ ### Cache Management
83
+ ```bash
84
+ # Clean the cache
85
+ uv cache clean
86
+
87
+ # Prune the cache
88
+ uv cache prune
89
+ ```
90
+
91
+ ## Best Practices
92
+ 1. Always use `uv sync` for installing dependencies
93
+ 2. Use `uv run` for running commands to ensure correct environment
94
+ 3. Use `uv add` for adding new dependencies
95
+ 4. Use `uv tree` to inspect dependencies
96
+ 5. Use `uv cache prune` periodically to manage cache size
97
+
98
+ ## Common Replacements
99
+ - `pip install` → `uv add`
100
+ - `pip install -e .` → `uv sync`
101
+ - `pip install -r requirements.txt` → `uv sync`
102
+ - `python -m pytest` → `uv run pytest`
103
+ - `pip freeze` → `uv export requirements.txt`
@@ -0,0 +1,17 @@
1
+ # Release v$VERSION
2
+
3
+ ## Release Notes
4
+
5
+ $CHANGELOG
6
+
7
+ ## Installation
8
+
9
+ We recommend [uv package manager](https://github.com/astral-sh/uv)
10
+
11
+ ```bash
12
+ uv add zeolite
13
+ ```
14
+
15
+ ## Documentation
16
+
17
+ For full documentation, visit [documentation site link].
@@ -0,0 +1,61 @@
1
+ name: Pre-Release
2
+
3
+ on:
4
+ push:
5
+ branches: [ 'release/**' ]
6
+
7
+ jobs:
8
+ prerelease:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ with:
21
+ enable-cache: true
22
+ cache-dependency-glob: "uv.lock"
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version-file: "pyproject.toml"
28
+
29
+ - name: Get version from branch
30
+ id: get_version
31
+ run: |
32
+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
33
+ VERSION=${BRANCH_NAME#release/}
34
+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
35
+ echo "Error: Branch name must be in format release/X.Y.Z"
36
+ exit 1
37
+ fi
38
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
39
+
40
+ - name: Install the project
41
+ run: uv sync --all-extras --dev
42
+
43
+ - name: Run tests
44
+ run: uv run pytest
45
+
46
+ - name: Build package
47
+ run: uv build
48
+
49
+ - name: Create Pre-Release
50
+ id: create_release
51
+ uses: softprops/action-gh-release@v1
52
+ with:
53
+ tag_name: v${{ steps.get_version.outputs.version }}-rc
54
+ name: Release Candidate v${{ steps.get_version.outputs.version }}
55
+ draft: true
56
+ prerelease: true
57
+ files: |
58
+ dist/*.whl
59
+ dist/*.tar.gz
60
+ env:
61
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,65 @@
1
+ # Publish a release to PyPI.
2
+ #
3
+ # Assumed to run as a subworkflow of .github/workflows/release.yml; specifically, as a publish job
4
+
5
+ name: Publish to PyPI
6
+
7
+ on:
8
+ push:
9
+ tags:
10
+ - 'v*.*.*'
11
+
12
+ jobs:
13
+ pypi-publish:
14
+ name: Upload zeolite to PyPI
15
+ runs-on: ubuntu-latest
16
+ environment:
17
+ name: release
18
+ permissions:
19
+ contents: read
20
+ id-token: write # IMPORTANT: this is needed for trusted publishing
21
+
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v5
29
+ with:
30
+ enable-cache: true
31
+ cache-dependency-glob: "uv.lock"
32
+
33
+ - name: Set up Python
34
+ uses: actions/setup-python@v5
35
+ with:
36
+ python-version-file: "pyproject.toml"
37
+
38
+ - name: Get version
39
+ id: get_version
40
+ run: |
41
+ # Extract version from tag (remove the 'v' prefix)
42
+ VERSION=${GITHUB_REF#refs/tags/v}
43
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
44
+
45
+ # Check if pyproject.toml version matches tag version
46
+ PYPROJECT_VERSION=$(uvx --from=toml-cli toml get project.version --toml-path=pyproject.toml)
47
+ if [ "$VERSION" != "$PYPROJECT_VERSION" ]; then
48
+ echo "Error: Tag version ($VERSION) does not match version in pyproject.toml ($PYPROJECT_VERSION)"
49
+ exit 1
50
+ fi
51
+
52
+ - name: Install dependencies
53
+ run: uv sync --all-extras --dev
54
+
55
+ - name: Run tests
56
+ run: uv run pytest
57
+
58
+ - name: Build package
59
+ run: uv build
60
+
61
+ - name: Publish package to PyPI
62
+ uses: pypa/gh-action-pypi-publish@release/v1
63
+ with:
64
+ verbose: true
65
+ # No need to specify password when using trusted publishing
@@ -0,0 +1,99 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+ jobs:
8
+ release:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ with:
16
+ fetch-depth: 0
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v5
20
+ with:
21
+ enable-cache: true
22
+ cache-dependency-glob: "uv.lock"
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version-file: "pyproject.toml"
28
+
29
+ - name: Get version
30
+ id: get_version
31
+ run: |
32
+ VERSION=$(uvx --from=toml-cli toml get project.version --toml-path=pyproject.toml)
33
+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
34
+ echo "Error: Version in pyproject.toml must be in format X.Y.Z"
35
+ exit 1
36
+ fi
37
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
38
+
39
+ - name: Install the project
40
+ run: uv sync --all-extras --dev
41
+
42
+ - name: Run tests
43
+ run: uv run pytest
44
+
45
+ - name: Build package
46
+ run: uv build
47
+
48
+ - name: Extract changelog
49
+ id: extract_changelog
50
+ run: |
51
+ # Install required tool
52
+ uv pip install -q python-changelog-generator
53
+
54
+ # Extract changelog for current version
55
+ if [ -f CHANGELOG.md ]; then
56
+ CHANGELOG=$(python -m changelog_generator extract --file CHANGELOG.md --version ${{ steps.get_version.outputs.version }})
57
+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
58
+ echo "$CHANGELOG" >> $GITHUB_OUTPUT
59
+ echo "EOF" >> $GITHUB_OUTPUT
60
+ else
61
+ echo "changelog=No CHANGELOG.md found" >> $GITHUB_OUTPUT
62
+ fi
63
+
64
+ - name: Generate release notes
65
+ id: release_notes
66
+ run: |
67
+ # Read the template
68
+ TEMPLATE=$(cat .github/release-template.md)
69
+
70
+ # Replace variables
71
+ NOTES="${TEMPLATE//\$VERSION/${{ steps.get_version.outputs.version }}}"
72
+ NOTES="${NOTES//\$CHANGELOG/${{ steps.extract_changelog.outputs.changelog }}}"
73
+
74
+ # Output the release notes
75
+ echo "notes<<EOF" >> $GITHUB_OUTPUT
76
+ echo "$NOTES" >> $GITHUB_OUTPUT
77
+ echo "EOF" >> $GITHUB_OUTPUT
78
+
79
+ - name: Create Git Tag
80
+ run: |
81
+ git config --local user.email "action@github.com"
82
+ git config --local user.name "GitHub Action"
83
+ git tag -a v${{ steps.get_version.outputs.version }} -m "Release v${{ steps.get_version.outputs.version }}"
84
+ git push origin v${{ steps.get_version.outputs.version }}
85
+
86
+ - name: Create Release
87
+ id: create_release
88
+ uses: softprops/action-gh-release@v1
89
+ with:
90
+ tag_name: v${{ steps.get_version.outputs.version }}
91
+ name: Release v${{ steps.get_version.outputs.version }}
92
+ body: ${{ steps.release_notes.outputs.notes }}
93
+ draft: false
94
+ prerelease: false
95
+ files: |
96
+ dist/*.whl
97
+ dist/*.tar.gz
98
+ env:
99
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,166 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+ .ruff_cache/
55
+
56
+ # Translations
57
+ *.mo
58
+ *.pot
59
+
60
+ # Django stuff:
61
+ *.log
62
+ local_settings.py
63
+ db.sqlite3
64
+ db.sqlite3-journal
65
+
66
+ # Flask stuff:
67
+ instance/
68
+ .webassets-cache
69
+
70
+ # Scrapy stuff:
71
+ .scrapy
72
+
73
+ # Sphinx documentation
74
+ docs/_build/
75
+
76
+ # PyBuilder
77
+ .pybuilder/
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don’t work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .env.shared
107
+ .venv
108
+ env/
109
+ venv/
110
+ ENV/
111
+ env.bak/
112
+ venv.bak/
113
+ !packages/env
114
+
115
+ # Spyder project settings
116
+ .spyderproject
117
+ .spyproject
118
+
119
+ # Rope project settings
120
+ .ropeproject
121
+
122
+ # mkdocs documentation
123
+ /site
124
+
125
+ # mypy
126
+ .mypy_cache/
127
+ .dmypy.json
128
+ dmypy.json
129
+
130
+ # Pyre type checker
131
+ .pyre/
132
+
133
+ # pytype static type analyzer
134
+ .pytype/
135
+
136
+ # Cython debug symbols
137
+ cython_debug/
138
+
139
+ # IDE
140
+ .idea
141
+
142
+
143
+ # Data folders
144
+ /app
145
+ .app/*
146
+ !.app/.gitkeep
147
+ !.app/README.md
148
+
149
+ ⚡️data
150
+ data
151
+
152
+ .data/*
153
+ !.data/.gitkeep
154
+ !.data/README.md
155
+
156
+ .scratch/*
157
+ !.scratch/.gitkeep
158
+ !.scratch/README.md
159
+ _delta_log
160
+
161
+ # Exclude CSV and Parquet files
162
+ *.csv
163
+ *.parquet
164
+
165
+ # Exclude DS_Store files
166
+ *.DS_Store
@@ -0,0 +1,32 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### What's Changed
11
+ - Changes in existing functionality
12
+
13
+ ### Deprecated
14
+ - Soon-to-be removed features
15
+
16
+ ### Removed
17
+ - Now removed features
18
+
19
+ ### Fixed
20
+ - Any bug fixes
21
+
22
+ ### Security
23
+ - In case of vulnerabilities
24
+
25
+ ## [0.1.0] - 2025-05-06
26
+
27
+ ### What's Changed
28
+ - Initial release
29
+ -
30
+
31
+ [Unreleased]: https://github.com/username/zeolite/compare/v0.1.0...HEAD
32
+ [0.1.0]: https://github.com/username/zeolite/releases/tag/v0.1.0
zeolite-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: zeolite
3
+ Version: 0.1.0
4
+ Summary: A library to process raw data into a structured format
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: polars>=1.29.0
7
+ Provides-Extra: dev
8
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
9
+ Requires-Dist: pytest>=7.0; extra == 'dev'
10
+ Requires-Dist: ruff>=0.2.0; extra == 'dev'
11
+ Description-Content-Type: text/markdown
12
+
13
+ # ⚗️ Zeolite
14
+
15
+ ---
16
+
17
+ Zeolite is a Python library that uses a simple configuration approach to define a table/schema structure. Raw
18
+ data can normalised, cleaned, and validated against the schema in a performant and standardised way.
19
+
20
+ The final datasets are guaranteed to be in the correct format and can be easily exported to a variety of formats.
21
+ In addition, Zeolite captures errors and warnings during the processing of the data, which can be used to improve
22
+ the quality of the data.
23
+
24
+
25
+
26
+ ### Example
27
+
28
+ ```python
29
+ import zeolite as z
30
+
31
+ individual_schema = z.schema("individual").columns(
32
+ z.str_col("id")
33
+ .clean(to="id", prefix="ORG_X::")
34
+ .validations(
35
+ z.check_is_value_empty(warning="any", error=0.1, reject=0.01, treat_empty_strings_as_null=True),
36
+ z.check_is_value_duplicated(check_on_cleaned=True, reject="any"),
37
+ ),
38
+
39
+ z.str_col("birthdate")
40
+ .clean(to="date")
41
+ .validations(z.check_is_value_invalid_date(reject="all")),
42
+
43
+ z.str_col("gender").clean(
44
+ to="enum",
45
+ sanitize="lowercase",
46
+ enum_map={
47
+ "m": "Male", "male": "Male",
48
+ "f": "Female", "female": "Female",
49
+ "d":"Gender Diverse", "diverse": "Gender Diverse"
50
+ },
51
+ ),
52
+
53
+ z.str_col("is_active").clean(
54
+ to="boolean",
55
+ true_values={"yes", "active"}, false_values={"no", "inactive"}
56
+ ),
57
+
58
+ z.str_col("ethnicity").clean(to="sanitised_string"),
59
+ z.str_col("ethnicity_2").clean(to="sanitised_string"),
60
+ z.derived_col(
61
+ "is_maori",
62
+ function=(
63
+ z.ref("ethnicity").clean().col.eq("maori")
64
+ | z.ref("ethnicity_2").clean().col.eq("maori")
65
+ ),
66
+ data_type="boolean",
67
+ ),
68
+ )
69
+
70
+
71
+ ```