Functional Weave
Code in Python

health.qrisk-inputs-validate@1.0.1

vectors.json

27,980 bytes · view raw

[
 {
  "name": "a complete, valid input set",
  "args": [
   {
    "age": 64,
    "sex": "male",
    "ethnicity": "indian",
    "postcode": "SW1A 1AA",
    "smoking": "ex-smoker",
    "diabetes": "type-2",
    "familyHistoryCvd": true,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": true,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 4.5,
    "systolicBp": 142,
    "systolicBpSd": 8.3,
    "heightCm": 176,
    "weightKg": 88,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "the minimum: required fields only, every optional one null",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "age 25 is the youngest accepted",
  "args": [
   {
    "age": 25,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "age 84 is the oldest accepted",
  "args": [
   {
    "age": 84,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "age 24 is out of range",
  "args": [
   {
    "age": 24,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "age",
     "reason": "out-of-range",
     "message": "Age: enter an integer between 25 and 84"
    }
   ]
  }
 },
 {
  "name": "age 85 is out of range",
  "args": [
   {
    "age": 85,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "age",
     "reason": "out-of-range",
     "message": "Age: enter an integer between 25 and 84"
    }
   ]
  }
 },
 {
  "name": "missing age and sex are both required",
  "args": [
   {
    "age": null,
    "sex": null,
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "age",
     "reason": "required",
     "message": "Age: enter an integer between 25 and 84"
    },
    {
     "field": "sex",
     "reason": "required",
     "message": "Sex: enter one of female, male"
    }
   ]
  }
 },
 {
  "name": "an ethnicity code outside the nine is unknown",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "asian",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "ethnicity",
     "reason": "unknown-value",
     "message": "Ethnicity: enter one of white-or-not-stated, indian, pakistani, bangladeshi, chinese, other-asian, black-caribbean, black-african, other"
    }
   ]
  }
 },
 {
  "name": "a smoking description rather than its code is unknown",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "light smoker (less than 10)",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "smoking",
     "reason": "unknown-value",
     "message": "Smoking status: enter one of non-smoker, ex-smoker, light, moderate, heavy"
    }
   ]
  }
 },
 {
  "name": "a postcode in lower case without its space is valid",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": "sw1a1aa",
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "a blank postcode means unknown, as on the calculator",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": "  ",
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "a postcode that cannot exist is reported",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": "QQ1 1QQ",
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "postcode",
     "reason": "bad-postcode",
     "message": "Postcode: the postcode is not recognised. Please re-enter or leave blank."
    }
   ]
  }
 },
 {
  "name": "cholesterol/HDL ratio 1.0 and SD 40.0 are the inclusive limits",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 1.0,
    "systolicBp": null,
    "systolicBpSd": 40.0,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "cholesterol/HDL ratio 11.0 and SD 0.0 are accepted",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 11.0,
    "systolicBp": null,
    "systolicBpSd": 0.0,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "cholesterol/HDL ratio 0.9 is out of range",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 0.9,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "cholesterolHdlRatio",
     "reason": "out-of-range",
     "message": "Cholesterol/HDL ratio: either leave blank or enter a number between 1.0 and 11.0."
    }
   ]
  }
 },
 {
  "name": "cholesterol/HDL ratio 11.1 is out of range",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 11.1,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "cholesterolHdlRatio",
     "reason": "out-of-range",
     "message": "Cholesterol/HDL ratio: either leave blank or enter a number between 1.0 and 11.0."
    }
   ]
  }
 },
 {
  "name": "systolic 210 is the highest accepted",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": 210,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": true,
   "errors": []
  }
 },
 {
  "name": "systolic 69 is out of range",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": 69,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "systolicBp",
     "reason": "out-of-range",
     "message": "Systolic blood pressure: either leave blank or enter an integer between 70 and 210"
    }
   ]
  }
 },
 {
  "name": "systolic 211 is out of range",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": 211,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "systolicBp",
     "reason": "out-of-range",
     "message": "Systolic blood pressure: either leave blank or enter an integer between 70 and 210"
    }
   ]
  }
 },
 {
  "name": "SD of systolic 40.1 is out of range",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": 40.1,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "systolicBpSd",
     "reason": "out-of-range",
     "message": "Standard deviation of SBP: either leave blank or enter a value between 0.0 and 40.0"
    }
   ]
  }
 },
 {
  "name": "height without weight is an incomplete pair",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": 170,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "weightKg",
     "reason": "incomplete-pair",
     "message": "You have only entered one of height and weight: please enter both or leave both blank."
    }
   ]
  }
 },
 {
  "name": "weight without height is reported against height",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": 70,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "heightCm",
     "reason": "incomplete-pair",
     "message": "You have only entered one of height and weight: please enter both or leave both blank."
    }
   ]
  }
 },
 {
  "name": "height 139 and weight 181 are both out of range",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": 139,
    "weightKg": 181,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "heightCm",
     "reason": "out-of-range",
     "message": "Height: enter an integer between 140 and 210"
    },
    {
     "field": "weightKg",
     "reason": "out-of-range",
     "message": "Weight: enter an integer between 40 and 180"
    }
   ]
  }
 },
 {
  "name": "height in metres is out of range, not silently converted",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": 2,
    "weightKg": 70,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "heightCm",
     "reason": "out-of-range",
     "message": "Height: enter an integer between 140 and 210"
    }
   ]
  }
 },
 {
  "name": "an existing CVD diagnosis makes QRISK3 not applicable",
  "args": [
   {
    "age": 64,
    "sex": "male",
    "ethnicity": "indian",
    "postcode": "SW1A 1AA",
    "smoking": "ex-smoker",
    "diabetes": "type-2",
    "familyHistoryCvd": true,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": true,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 4.5,
    "systolicBp": 142,
    "systolicBpSd": 8.3,
    "heightCm": 176,
    "weightKg": 88,
    "existingCvd": true,
    "onStatins": false
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "existingCvd",
     "reason": "not-applicable",
     "message": "QRISK3 is only valid for people without a diagnosis of coronary heart disease (including angina or heart attack) or stroke/transient ischaemic attack."
    }
   ]
  }
 },
 {
  "name": "taking a statin makes QRISK3 not applicable",
  "args": [
   {
    "age": 64,
    "sex": "male",
    "ethnicity": "indian",
    "postcode": "SW1A 1AA",
    "smoking": "ex-smoker",
    "diabetes": "type-2",
    "familyHistoryCvd": true,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": true,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 4.5,
    "systolicBp": 142,
    "systolicBpSd": 8.3,
    "heightCm": 176,
    "weightKg": 88,
    "existingCvd": false,
    "onStatins": true
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "onStatins",
     "reason": "not-applicable",
     "message": "QRISK3 is only valid for people who are not on statins."
    }
   ]
  }
 },
 {
  "name": "several problems at once come back in field order",
  "args": [
   {
    "age": 90,
    "sex": "male",
    "ethnicity": null,
    "postcode": "SW1A 1AA",
    "smoking": "ex-smoker",
    "diabetes": "type 2",
    "familyHistoryCvd": true,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": true,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": 4.5,
    "systolicBp": 300,
    "systolicBpSd": 8.3,
    "heightCm": 176,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": true
   }
  ],
  "expect": {
   "valid": false,
   "errors": [
    {
     "field": "age",
     "reason": "out-of-range",
     "message": "Age: enter an integer between 25 and 84"
    },
    {
     "field": "ethnicity",
     "reason": "required",
     "message": "Ethnicity: enter one of white-or-not-stated, indian, pakistani, bangladeshi, chinese, other-asian, black-caribbean, black-african, other"
    },
    {
     "field": "diabetes",
     "reason": "unknown-value",
     "message": "Diabetes status: enter one of none, type-1, type-2"
    },
    {
     "field": "systolicBp",
     "reason": "out-of-range",
     "message": "Systolic blood pressure: either leave blank or enter an integer between 70 and 210"
    },
    {
     "field": "weightKg",
     "reason": "incomplete-pair",
     "message": "You have only entered one of height and weight: please enter both or leave both blank."
    },
    {
     "field": "onStatins",
     "reason": "not-applicable",
     "message": "QRISK3 is only valid for people who are not on statins."
    }
   ]
  }
 },
 {
  "name": "a fractional age is a type error, not a clinical one",
  "args": [
   {
    "age": 40.5,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": null,
    "weightKg": null,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expectError": "age must be a whole number or null"
 },
 {
  "name": "a height with a fraction is refused: the calculator takes whole centimetres",
  "args": [
   {
    "age": 40,
    "sex": "female",
    "ethnicity": "white-or-not-stated",
    "postcode": null,
    "smoking": "non-smoker",
    "diabetes": "none",
    "familyHistoryCvd": false,
    "chronicKidneyDisease": false,
    "atrialFibrillation": false,
    "bloodPressureTreatment": false,
    "migraine": false,
    "rheumatoidArthritis": false,
    "systemicLupus": false,
    "severeMentalIllness": false,
    "atypicalAntipsychotic": false,
    "corticosteroids": false,
    "erectileDysfunction": false,
    "cholesterolHdlRatio": null,
    "systolicBp": null,
    "systolicBpSd": null,
    "heightCm": 172.5,
    "weightKg": 70,
    "existingCvd": false,
    "onStatins": false
   }
  ],
  "expectError": "heightCm must be a whole number or null"
 }
]