OpenDataServices / cove

CoVE is an web application to Convert, Validate and Explore data following certain open data standards - including 360Giving, Open Contracting Data Standard, IATI and the Beneficial Ownership Data Standard
http://cove.opendataservices.coop
Other
43 stars 11 forks source link

[SPIKE] 1 day to form an opinion on what we need rulesets to do, and thus which technology to use #702

Closed robredpath closed 7 years ago

robredpath commented 7 years ago

We know that we want to test data against sets of rules. We know that there are at least 3 ways that we can do this:

We should take 1 day to work out:

robredpath commented 7 years ago

I'll do the 'what do we want to test' part, @kindly will evaluate the options

andylolz commented 7 years ago

@andylolz 's YAML format

NB these days I’m using gherkin for this. Here are some sample tests.

robredpath commented 7 years ago

Thanks @andylolz ! How're you finding it?

andylolz commented 7 years ago

Yeah, gherkin is fine for this I think (I’ve previously used it for actual BDD on ODI projects.) I expect tests run slower than they would with a bespoke thing like the IATI rulesets tester… But gherkin/cucumber are pretty widely used / well-documented / maintained etc, so that’s the trade-off I suppose.

kindly commented 7 years ago

I have been doing some research on the suggested options. I am excluding @andylolz yaml format as he is now using gherkin anyway and it has no overriding benefit over the other options.

Schematron

This is a standard way of doing these kind of rulesets in xml and is commonly used in conjunction with xmlschema. It is different from xmlschema as you do not have to specify the whole structure of the document but just certain constraints or rules that you want it to conform to.

I found this pdf a good primer to it.

Pros:

Cons

Iati Ruleset Language (made by Ben)

Pros:

Cons:

Gherkin

Pros:

Cons:

Conclusion

I have come round to the idea of using gherkin, especially as the human readability of the rulesets is so much better then any other option and at least the structure of the rules are standard. Some part of me thinks schematron is the "proper" way to do this (as its a standard and has lots of support) but it will take some learning for any coder to understand how to write them. It is also a taste thing as I do not have much experience of XML and gherkins look much easier to get started with especially as @andylolz has already begun this work.

andylolz commented 7 years ago

I wonder if it’s worth mentioning:

Obviously this is all for the IATI-specific flavour of CoVE, buuut… I suppose it’s possible you might at some point want something similar to this for 360giving / OpenContracting? Is that a consideration? (It’s possible this was baked into the “In XML!” con against schematron.)

robredpath commented 7 years ago

@andylolz yup, we're having a conversation about how this cuts across standards at the moment; this is a theme that's either come up or is on the horizon for both OCDS and 360, so we're hoping to find a solution that can be widely applied.