Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrich narrative schema generation with rules that use regular expressions #7

Open
jwoLondon opened this issue Oct 29, 2018 · 0 comments
Labels
enhancement New feature or request priority/p3

Comments

@jwoLondon
Copy link
Member

Currently (as of litvis@0.7.0), narrative schemas can use rules that

  • require the presence, or a number of instances, of a label (minimumOccurrences)
  • require minimum content length within a paired label (minimumTrimmedTextLength)
  • require that one label follows another, allowing label orders to be defined (followedBy)

What we are not able to do yet is validate against specific content within paired labels. One approach would be to add the ability to validate against a regex. This would give us some flexibility in validating content.

One open question is whether we simply allow a boolean regexMatch (as below), or whether we can process the returned matched values in some way within the YAML rule definition.

Some Examples

Vis Algebra

We might require that for a vis algebra schema, content must include reference to hallucinators, confusers, jumblers and misleaders under the relevant 'principle' assessment:

 - description: invariance assessment must make reference to hallucinators.
    selector:
      label: invarianceAssessment
    children:
      regexMatch: [hH]allucinator

 - description: unambiguity assessment must make reference to confusers.
    selector:
      label: unambiguityAssessment
    children:
      regexMatch: [cC]onfuser

 - description: data-visualization correspondence assessment must make reference to jumblers and misleaders.
    selector:
      label: correspondenceAssessment
    children:
      regexMatch: (?=.*[jJ]umbler)(?=[\s\S]*[mM]isleader).+

Unit Testing

Rather than just add a checkbox to some content that requires a subjective judgement as to whether it has passed, we might use regex to validate that the user has confirmed the test has taken place and has passed:

 - description: must include a '[ ] passed?' checkbox.
    selector:
      label: myTestableLabel
    children:
      regexMatch: \[.\] [pP]assed\?

 - description: test has not passed.
    selector:
      label: myTestableLabel
    children:
      regexMatch: \[x\] [pP]assed\?

These are only suggestions for the syntax. We might need to escape special characters depending on how tolerant YAML is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/p3
Projects
None yet
Development

No branches or pull requests

1 participant