opensafely-core / opensafely-core/opencodelists

Make the selection of codes in `test_build_codelist.py` unambiguous

Open
#2,666 0 comments 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?

While working on #2574, I realised that the data-code attribute can be duplicated.

The existing tests in test_build_codelist.py work by specifying selections as ConceptSelections.

They work as is because the expanded hierarchies currently used only contain a selected data code once. If we want to test a case where a expanded hierarchy contains a code multiple times (for example, testing cases in conflict), we cannot yet do this.

The existing selector matches on the data-code and this will fail in these cases.

How will we know when it's done?

When it's possible for the tests in test_build_codelist.py to have a code appear multiple times in a hierarchy.

What are we doing?

If we want to fix this, one approach might be specifying an unambiguous parent code of a particular code "row", and using that in the selector to determine which "row" is meant.


Defining delivery tasks guidance

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 by reading test_build_codelist.py and the ConceptSelections-based selector to see how rows are currently matched by data-code. Run the existing tests, then define how a parent code identifies a specific duplicate row and update the test selections so repeated codes can be represented. Done means the tests can include the same data code multiple times in one expanded hierarchy without ambiguous matching.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.