opensafely-core / opensafely-core/opencodelists

Validate the contents of the search tab for a codelist in functional tests

Open
#2,544 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
60
Forks
16
Avg merge
4d 12h
Merged PRs (30d)
17

Description

Why are we doing this?

#2421 adds some functional tests.

A codelist's search tab lists searches, along with codes and whether those codes are included or excluded.

We're not validating this tab yet. It would be good to ensure it is correct.

How will we know when it's done?

When our tests that verify the codelist result also check the searches, checking:

  • the presence of each search that was entered to build the codelist
  • that each included and excluded code for each search is as is expected

What are we doing?

This will need:

  • The data from the Searches tab (for each search, the concept code and text) extracting.
  • Deriving the expected state of each search:
    • This may depend on #2541, which proposes using the relevant backend code to derive final concept states (whether included or excluded, for example).
    • However, even without #2541, I think it should be possible to derive the final state of the concepts in a codelist search by:
      1. Do something like what we do for expected_codelist_table(); take each concept selection in turn, and store the state (INCLUDED or EXCLUDED) for each code. The latest selection is the one that determines the final state.
      2. Re-apply those states to the concept selections in each search. That should give the expected state for the search (assuming we explicitly state each selection for every search).
  • It may also be worthwhile to add some markup that makes it easier to discern included and excluded codes; at the moment, this is based on colour styling only, which is fragile.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the functional tests added by #2421 and the existing expected_codelist_table() helper. Trace how the Searches tab exposes each search's concept code and text, then define expected included or excluded states from the selections, considering the dependency on #2541. Done means the codelist result tests verify every entered search and each code's expected state.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.