frictionlessdata/frictionless-py

Validating Combinations of Fields in CSV Files

Opened this issue · 1 comments

Overview

How can I perform Validating Combinations of Fields?

Example:
Validate that all combinations of the ENCOUNTER_CLASS_CODE and ENCOUNTER_CLASS_CODE_DESCRIPTION fields in the primary CSV file exactly match the data given in the validation file. The check should ensure that each pair of ENCOUNTER_CLASS_CODE and ENCOUNTER_CLASS_CODE_DESCRIPTION in the primary CSV exists in the validation.json file using enum fields.

{
  "name": "ENCOUNTER_CLASS_CODE",
  "type": "string",
  "constraints": {
    "required": true,
    "enum": [
      "amb",
      "emer",
      "fld",
      "hh",
      "imp",
      "acute",
      "nonac",
      "obsenc",
      "prenc",
      "ss",
      "vr"
    ]
  }
},
{
  "name": "ENCOUNTER_CLASS_CODE_DESCRIPTION",
  "type": "string",
  "constraints": {
    "enum": [
      "ambulatory",
      "emergency",
      "field",
      "home health",
      "inpatient encounter",
      "inpatient acute",
      "inpatient non-acute",
      "observation encounter",
      "pre-admission",
      "short stay",
      "virtual"
    ]
  }
}

If the ENCOUNTER_CLASS_CODE value is 'amb', the ENCOUNTER_CLASS_CODE_DESCRIPTION value should be 'ambulatory'. is it possible? Please help.