
Compute Comprehensive Quality Control Checks for Harmonized HRMIS Data
compute_qualitycontrol.RdRuns a full suite of QC diagnostics across the three harmonized HRMIS
modules—contract, personnel, and establishment. Rule-based validation
uses the validate framework and the built-in
govhr::contract_rules / govhr::personnel_rules datasets,
optionally extended with country-specific rules supplied via
custom_rules.
Usage
compute_qualitycontrol(
contract_dt,
personnel_dt,
est_dt,
custom_rules = list(contract = NULL, personnel = NULL)
)Arguments
- contract_dt
A data.frame or data.table — harmonized Contract module.
- personnel_dt
A data.frame or data.table — harmonized Personnel module.
- est_dt
A data.frame or data.table — harmonized Establishment module.
- custom_rules
A named list with optional elements
contractandpersonnel, each a data.frame with the same four-column schema asgovhr::contract_rules(rule,name,description,label). These rows are appended to the package-level rules before validation. UseNULL(the default) to run only the built-in rules.
Value
A named list:
n_obsRow count of the Contract module.
n_varsColumn count of the Contract module.
structureDictionary-comparison results for each module.
orphansOrphan ID diagnostics.
validationNamed list:
contractandpersonnelaudit reports fromvalidate_data().missingnessLong-format data.table of missingness by group, with columns
group_var,group_label,group_val,target_var,target_label,n_missing,N, andpct_missing.volatilityNamed list:
contractandpersonnelflat data.tables fromflatten_volatility().temporal_coverageNamed list:
contract,personnel(if supplied), andestablishment(if supplied), each a data.table with columnsref_dateandn_obsshowing the observation count per snapshot.metadataNamed list with
date_range(min/max ref_date across all modules),n_obs(row counts per module), andn_vars(column counts per module).
Details
- Structure checks
Variable names checked against the harmonization dictionary for each module.
- Orphan checks
Cross-module referential integrity: personnel and establishment IDs in the Contract module are checked against their parent modules.
- Rule-based validation
govhr::contract_rulesandgovhr::personnel_rules(plus anycustom_rules) are evaluated viavalidate_data(), covering uniqueness, date logic, salary consistency, working hours, age ranges, and more.- Missingness profiling
Missingness by key grouping variables (contract type, occupation, reference date). Groups are silently skipped if the column is absent from the data.
- Volatility analysis
Period-over-period percent change for salaries, contract counts, working hours, occupation diversity, and contract-type diversity, each by multiple groupings. Groupings are silently skipped if the required columns are absent.