Skip to content

Frictionless Py: How to Validate Conditional Field Dependencies in CSV? #1742

Open
@megin1989

Description

@megin1989

🚀 Issue Summary

I’m using Frictionless Py to validate a CSV file and need help enforcing some conditional validation rules.

✅ Expected Validation Rules

1️⃣ Conditional Enum Validation:

  • If the country_code field contains "US", then the country_description field must be "United States".

2️⃣ Conditional Presence Validation:

  • If one field contains a value, another specific field must not be empty.

3️⃣ Conditional Answer Code Validation:

  • If the code field contains "44250-9", then the answer_code field must be one of:
    "LA6568-5", "LA6569-3", "LA6570-1", or "LA6571-9".

4️⃣ Warning Instead of Error Validation:

For some validation failures, we would prefer to show warnings rather than blocking errors. Is there a way to configure this in Frictionless Py?

5️⃣ Handling Multiple Values in a Single Field

Does Frictionless support validating multiple values in a single field when separated by a semicolon (;)? Currently, it only supports enum validation with a single value. Is there a way to enable validation for multiple values using a semicolon as the separator?

🔧 What I’ve Tried

I’ve explored the Frictionless schema and custom validation checks, but I’m not sure about the best approach to enforce these conditions.

💡 Questions

  • What is the recommended way to implement these rules in Frictionless Py?
  • Should I use custom validation functions or is there a built-in way to handle these dependencies?
  • Any examples or references would be greatly appreciated!

Thanks in advance for any guidance! 🙌

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions