Skip to content
This repository has been archived by the owner on Jan 18, 2020. It is now read-only.

Context Validation

bruth edited this page Feb 19, 2013 · 7 revisions

Flow

  • New or modified context nodes are validated
    • Invalid context trees are not saved
    • The node's natural language representation are computed and saved for future reference
  • Existing nodes are re-validated upon use
    • Invalid nodes are automatically flagged ignore=true to prevent returning no or bogus results
    • Validation errors will be attached onto the node
  • Ignored nodes can be forced to be used by setting ignore=true
    • Until the node is changed or removed, this flag will remain so the node does not get redundantly validated
{
    "concept": 4,
    "field": 39,
    "value": 54,
    "operator": "gt",
    "nulls": false,
    "nlang": "PTA is greater than 54",
    "ignore": true,
    "errors": ["Value out of range"]
}

Errors

  • VALUE_OUT_OF_RANGE - Value out of range
    • Applies to numerical values that are greater than the max or less than the min
  • VALUE_NOT_A_CHOICE - Value not a choice
    • Applies to enumerable or key-based data where the value is not in the set
  • INVALID_OPERATOR - Invalid operator
    • The operator supplied is not valid for the field
  • INVALID_OPERATOR_OR_VALUE - Invalid operator or value
    • The combination of operator and value are invalid, e.g. between query with a single value

Implementation

  • settings

    • AUTO_REMOVE_CONDITIONS
      • auto-flag conditions that were once there or valid, but are no longer
  • serialization

    • stringify and humanize conditions in plain text
      • ensures original representation and meaning does not change for warning messages
    • warning messages at the concept-level (if one exists)
  • changes

    • hard validation occurs for new conditions
    • soft validation occurs during restore and use
      • this involves flagging conditions that are no longer valid
    • ignore flagged conditions rather

Client Considerations

  • show warning messages per concept/field
  • provide remediation options
    • confirm removal
      • this will remove the condition permanently from the tree
    • revoke removal
      • certain use cases may deal with volatile data and the data may appear eventually
Clone this wiki locally