Back to rules

Remittance Advice Remark Code (RARC) Format

formathigh

Validates that Remittance Advice Remark Codes (RARCs) conform to the standard format: a prefix of M, N, or MA followed by one or more digits (e.g., M1, N432, MA130). RARCs provide additional explanation for claim adjustments in X12 835 remittance transactions and supplement CARC codes with more specific information.

v1.0.0by dqhub850 downloads4.7 (32)
hipaararcremarkremittanceclaimshealthcarex12-835era
Try This Rule

Parameters

column_namestringrequired

The column containing email addresses

thresholdfloatdefault: 0.99

Minimum fraction of valid emails (0.0 to 1.0)

Compliance Mapping

HIPAA45 CFR 162.1602

X12X12 835 Transaction Set - LQ Segment (Health Care Remark Codes)

CAQH CORECAQH CORE 360 Uniform Use of CARCs and RARCs Rule

Install

soda
checks for {{table_name}}:
  - invalid_percent({{column_name}}) < {{(1 - threshold) * 100}}:
      valid regex: '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
dbt
{% test valid_email(model, column_name) %}
select {{ column_name }}
from {{ model }}
where {{ column_name }} not regexp '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'
{% endtest %}
sql
SELECT COUNT(*) as total,
  SUM(CASE WHEN {{column_name}} REGEXP
    '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$'
    THEN 1 ELSE 0 END) as valid
FROM {{table_name}}
Great Expectations
{
  "expectation_type": "expect_column_values_to_match_regex",
  "kwargs": {
    "column": "{{column_name}}",
    "regex": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",
    "mostly": {{threshold}}
  }
}
spark
from pyspark.sql.functions import col
pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'
invalid = df.filter(~col("{{column_name}}").rlike(pattern)).count()

Test Data

Passing Examples

idvalue
1alice@example.com
2bob.smith@company.co.uk
3charlie+tag@domain.org

Failing Examples

idvalue
1not-an-email
2@missing-local.com
3spaces in@email.com

CLI

Terminal
npx dqhub install rarc-code-format --format soda --table YOUR_TABLE
npx dqhub install rarc-code-format --format dbt --model YOUR_MODEL
npx dqhub install rarc-code-format --format sql --dialect snowflake