Overview
Thequality_control module provides functions to validate and correct land values and other assessment data. It performs sanity checks and applies corrections to ensure data quality.
check_land_values()
Parameters
DataFrame containing assessment data with land and market values
The model group being validated (e.g., “residential”, “commercial”)
Returns
A copy of the input DataFrame with corrected land values
Quality Checks Performed
The function performs the following validation checks:1. Negative Values
- Market value: Cannot be negative
- Land value: Cannot be negative
- Improvement value: Cannot be negative
2. Land vs Market Value
- Land > Market: Land value cannot exceed total market value
- Separate tracking for vacant vs improved properties
3. Land Allocation
- Improved properties: Land allocation should be less than 1.0 (building has value)
- Vacant properties: Land allocation should equal 1.0 (no building value)
4. Consistency Checks
- Market value must equal land value + improvement value
- Land allocation must equal land value / market value
Corrections Applied
When validation failures are detected, the function applies the following corrections:- Negative values: Set to zero or minimum threshold
- Land > Market: Cap land value at market value
- Invalid allocations: Recalculate based on building presence
- Inconsistencies: Recompute derived fields
Example Usage
Validation Report
The function tracks the number of violations for each check:Best Practices
Review corrections manually
Review corrections manually
Always review a sample of corrected records to ensure the automated fixes are appropriate for your jurisdiction’s assessment practices.
Track correction rates
Track correction rates
Monitor the percentage of records requiring correction over time. High correction rates may indicate upstream data quality issues.
Preserve original values
Preserve original values
Keep the original uncorrected data for audit purposes and to track data quality trends.
Document exceptions
Document exceptions
Some legitimate cases may trigger false positives (e.g., contaminated sites with negative improvement value). Document these exceptions.
Related
Land Valuation
Land value modeling functions
Assessment Quality
Overall quality metrics and evaluation