opensafely-core / ehrql

ehrQL: the electronic health record query language for OpenSAFELY
https://docs.opensafely.org/ehrql/
Other
7 stars 3 forks source link

Spec tests do not demonstrate `take`/`drop` alone #758

Open StevenMaude opened 2 years ago

StevenMaude commented 2 years ago

Though take apparently works with frames to give another frame, it's not covered in the spec tests.

evansd commented 2 years ago

I don't quite follow this: take/drop only works as a frame->frame operation.

StevenMaude commented 2 years ago

I probably didn't explain well enough or even understand clearly enough myself; sorry! (I'm possibly still a little muddled in how series and frames work too.)

In this case, what I mean: none of the current spec tests show the bare result of take/drop, but are used in conjunction with selection of a column and/or aggregation, to give a series.

That means it's easy to miss — as I did — that take/drop goes from frame :arrow_right: frame.

What's then missing: an example of the outcome of a take/drop without further chained methods.

evansd commented 2 years ago

Oh I see, yes. In one sense it's impossible to demonstrate what you want to demonstrate via spec tests, because the only way to get anything out of ehrQL requires getting a series and attaching it to a dataset.

I feel like this comes back to a question I've raised before, which is that it's not quite clear to me how the spec tests can properly play the roles of being both tests and documentation at the same time.

StevenMaude commented 2 years ago

Yes, I agree!

Though I think the spec tests are pretty good at this stage, in lieu of anything more dedicated right now.

(With respect to user testing, we can sandpaper over any important gaps by explicitly mentioning them in the tutorial, or somewhere else appropriate.)