Skip to main content

Validation Engine

The engine categorizes parsing anomalies into Errors (blocking for that specific row) and Warnings (non-blocking).

Validation Categories

🛑 Errors (Row Excluded)

  • Invalid Number: Failed libphonenumber isValidNumber().
  • Impossible Number: Too short, too long, or violates ITU-T formatting.
  • Missing Required Fields: The row has no recognizable phone numbers.
  • Malformed Row: Corrupt CSV data.

⚠️ Warnings (Row Included)

  • Duplicate Contact: Number already exists in DB (will be merged or ignored based on strategy).
  • File Duplicate: Number appears twice in the same upload file.
  • Ambiguous Country Inference: A number lacking a + sign was guessed using fallback logic.

Validation State Machine

Multiple Numbers Per Row

If a row contains multiple numbers (e.g., Rajiv & Suhail | 9962665705 | 7358559280), the parser runs regex /(?:\+?\d{1,3}[\s-]?)?(?:\d{10,13})/g across all dynamic columns. For every valid match, a discrete Contact record is staged, preserving the original display name Rajiv & Suhail for both.