Skip to content

Validation Rules Reference

A complete list of all validation rule identifiers that dicom-validator-ts can produce. Each rule includes its severity, a description of the violation, and a suggested resolution.

Severity Levels

LevelMeaning
errorDICOM standard conformance violation. Data correction is required
warningPotential issue. Review recommended
infoInformational. No action required

VR Validation

Validation rules for Value Representation (VR) format constraints.

RuleSeverityDescriptionResolution
vr-format-AEerrorApplication Entity format violation (exceeds 16 chars, contains backslash, or contains control characters)Limit the value to 16 characters and remove backslashes and control characters
vr-format-ASerrorAge String format violation (not 4 characters, not in NNN[DWMY] format)Correct the value to NNN[DWMY] format (e.g., 045Y) with exactly 4 characters
vr-format-CSerrorCode String format violation (exceeds 16 chars or contains disallowed characters)Limit the value to 16 characters using only uppercase letters, digits, spaces, and underscores
vr-format-DAerrorDate format violation (not in YYYYMMDD format or invalid month/day)Correct the value to a valid date in YYYYMMDD format (e.g., 20240101)
vr-format-DSerrorDecimal String format violation (exceeds 16 chars or not a valid numeric format)Correct the value to a valid decimal string of 16 characters or fewer (e.g., 3.14, -1.0e2)
vr-format-ISerrorInteger String format violation (exceeds 12 chars or not a valid integer format)Correct the value to a valid integer string of 12 characters or fewer (e.g., 42, -100)
vr-format-LOerrorLong String format violation (exceeds 64 characters)Shorten the value to 64 characters or fewer
vr-format-LTerrorLong Text format violation (exceeds 10240 characters)Shorten the value to 10240 characters or fewer
vr-format-PNerrorPerson Name format violation (too many component groups, group too long, or too many components)Limit to 3 groups max, 64 characters per group, and 5 components per group
vr-format-SHerrorShort String format violation (exceeds 16 characters)Shorten the value to 16 characters or fewer
vr-format-STerrorShort Text format violation (exceeds 1024 characters)Shorten the value to 1024 characters or fewer
vr-format-TMerrorTime format violation (not in HHMMSS.FFFFFF format or invalid hour/minute/second)Correct the value to a valid time in HH, HHMM, HHMMSS, or HHMMSS.FFFFFF format
vr-format-UIerrorUnique Identifier format violation (exceeds 64 chars or invalid format)Limit to 64 characters and use only digits and periods to form a valid UID
vr-format-URerrorURI format violation (contains trailing spaces)Remove trailing spaces from the value
vr-format-UTerrorUnlimited Text format violation (exceeds maximum length)Shorten the value to the maximum length (2^32-2 characters) or fewer

VM Validation

Validation rules for Value Multiplicity (VM) constraints.

RuleSeverityDescriptionResolution
vm-constrainterrorValue Multiplicity constraint violation (number of values does not match the tag's VM definition)Set the number of values to match the VM constraint specified in the tag definition

Module Validation

Validation rules for attribute presence and value constraints within DICOM modules.

RuleSeverityDescriptionResolution
type1-missingerrorType 1 (required) attribute is missing from the datasetAdd the required attribute to the dataset
type1-emptyerrorType 1 attribute has an empty value (Type 1 attributes must not be empty)Set a valid value for the attribute
type2-missingwarningType 2 attribute is missing (empty values are allowed but the attribute itself is required)Add the attribute to the dataset (value may be empty)
condition-indeterminateinfoCondition for a conditional attribute (Type 1C/2C) cannot be evaluatedVerify that the related attributes needed for condition evaluation are present in the dataset

IOD Validation

Validation rules for Information Object Definition (IOD) structure.

RuleSeverityDescriptionResolution
iod-sop-class-missingerrorSOP Class UID tag (0008,0016) is missing from the datasetAdd the SOP Class UID tag to the dataset
iod-sop-class-unknownerrorSOP Class UID is not recognized (not found in the dictionary)Set a valid SOP Class UID or specify one via the sopClassUID option
iod-module-not-foundwarningModule definition referenced by the IOD is not found in the dictionaryVerify that the module dictionary is up to date
iod-module-condition-indeterminateinfoInclusion condition for a conditional module cannot be evaluatedVerify that the related attributes needed for condition evaluation are present in the dataset
unexpected-tagwarningA tag present in the dataset is not defined in any module of the applicable IOD and is not a private tag or File Meta Information tagVerify the tag is appropriate for the SOP Class or remove it

Tag Validation

Validation rules for individual tag inspection.

RuleSeverityDescriptionResolution
vr-unknownwarningNo validator is registered for the specified VRVerify the VR is correct. If the VR is unsupported, this can be safely ignored
vr-undeterminedwarningThe tag's VR cannot be determined (not in dictionary and no explicit VR)Verify the tag is correct and consider using an explicit VR transfer syntax
private-tag-skippedinfoValidation of a private tag was skippedNo action needed. Private tags are excluded from standard validation
retired-taginfoA retired tag is being usedConsider replacing with the current equivalent tag if available

Using Rule Identifiers

You can use the rule field from validation findings to filter and categorize results:

typescript
import { validate } from 'dicom-validator-ts';

const result = await validate('path/to/file.dcm');

// Get errors only
const errors = result.findings.filter(f => f.severity === 'error');

// Filter by specific rules
const vrErrors = result.findings.filter(f => f.rule.startsWith('vr-format-'));
const moduleErrors = result.findings.filter(f =>
  ['type1-missing', 'type1-empty', 'type2-missing'].includes(f.rule)
);

// Count findings by rule
const ruleCount = result.findings.reduce((acc, f) => {
  acc[f.rule] = (acc[f.rule] || 0) + 1;
  return acc;
}, {} as Record<string, number>);

// Filter unexpected tags
const unexpectedTags = result.findings.filter(f => f.rule === 'unexpected-tag');

v0.2.0