Registry / data / emrvalidator

emrvalidator

JSON →
library1.0.2pypypi✓ verified 88d ago

EMR Validator (emrvalidator) is a Python library designed for comprehensive data validation of healthcare data. It allows users to define validation rules in an Excel-based schema and apply them to various data formats like CSV. The current version is 1.0.2, and it receives active maintenance with minor releases addressing bug fixes and enhancements.

pip install emrvalidator
INSTALL
IMPORT
SIG · EMRVALIDATOR
E
emrvalidator
datapythonv1.0.2
Install
7.6s avg
Import
—
Disk
164MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.0.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 164.8MB
glibc
py 3.10–3.910 runs
installs and imports cleanly · install 7.6s · import 0.000s · 157MB
164MB installed
● package 164MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

DataValidator
✓ from emrvalidator import DataValidator
✗ from emrvalidator import EMRValidator
DataProfiler
✓ from emrvalidator import DataProfiler
ValidationRule
✓ from emrvalidator import ValidationRule

This quickstart demonstrates how to set up and run a basic data validation using `EMRValidator`. It first creates dummy `schema.xlsx` and `data.csv` files in temporary locations for a runnable example, then initializes `EMRValidator` with these paths, runs the validation, and prints the summary, invalid records, and validated records. In a real application, `schema_path` and `data_path` would point to your actual data files.

import os import pandas as pd from emrvalidator import EMRValidator # --- Dummy file creation for runnable example START --- # In a real scenario, you would have these files pre-existing. schema_data = { "Column Name": ["PatientID", "Name", "Age", "AdmissionDate"], "Data Type": ["STRING", "STRING", "INTEGER", "DATETIME"], "Is Mandatory": ["YES", "YES", "YES", "NO"], "Allowed Values": ["", "", "", ""], "Min Length": ["", "2", "0", ""], "Max Length": ["", "50", "120", ""], "Regex Pattern": ["", "", "", ""] } schema_df = pd.DataFrame(schema_data) # Using tempfile for demonstration, replace with your actual file paths import tempfile temp_dir = tempfile.gettempdir() schema_path = os.path.join(temp_dir, "registry_schema.xlsx") data_path = os.path.join(temp_dir, "registry_data.csv") with pd.ExcelWriter(schema_path, engine='openpyxl') as writer: schema_df.to_excel(writer, index=False, sheet_name='Sheet1') data_csv_content = """PatientID,Name,Age,AdmissionDate P001,Alice,30,2023-01-15 P002,Bob,25, P003,Charlie,40,2024-03-20 """ with open(data_path, 'w') as f: f.write(data_csv_content) # --- Dummy file creation for runnable example END --- # Initialize the EMRValidator # Replace 'schema_path' and 'data_path' with your actual file paths validator = EMRValidator(schema_path=schema_path, data_path=data_path) # Run the validation validation_result = validator.validate() # Get summary of validation summary = validator.get_summary() print("Validation Summary:") print(summary) # Get invalid records invalid_records = validator.get_invalid_records() if not invalid_records.empty: print("\nInvalid Records:") print(invalid_records) else: print("\nNo invalid records found.") # Get validated records validated_records = validator.get_validated_records() if not validated_records.empty: print("\nValidated Records:") print(validated_records) # Clean up temporary files (optional, for demonstration) os.remove(schema_path) os.remove(data_path)
emrvalidator --version
Debug
Known issues
gotchaThe schema definition (e.g., `schema.xlsx`) must strictly adhere to the expected column headers and structure described in the documentation. Incorrect headers, missing mandatory columns, or deviations in format will lead to validation failures or `KeyError`.
fix
Refer to the official documentation or example `schema.xlsx` for the exact format required for schema definition. Ensure column names like 'Column Name', 'Data Type', 'Is Mandatory', 'Allowed Values', 'Min Length', 'Max Length', and 'Regex Pattern' are spelled correctly and present.
affects: All versions
gotchaData type definitions in the schema (`Data Type` column) must use specific keywords recognized by the library (e.g., 'STRING', 'INTEGER', 'DECIMAL', 'DATETIME', 'BOOLEAN'). Mismatches between these keywords and actual data types or unrecognized keywords will cause validation errors.
fix
Consult the documentation for the precise list of supported data types. Ensure your schema uses these exact keywords for the 'Data Type' column entries.
affects: All versions
Upgrade
Version history
1.0.2latest on PyPI · released Jan 26, 2026
Audit
Dependencies
pandasrequiredCore data manipulation and I/O for CSV and Excel files.
openpyxlrequiredRequired for reading and writing Excel schema files (.xlsx).
numpyrequiredFundamental package for numerical computing, often a dependency of pandas.
tabulaterequiredUsed for pretty-printing validation summaries and results to the console.
Agent activity
6 hits · last 30 days
node
6
Resources
emrvalidator — pip install emrvalidator · libregistry