opensafely-core / opensafely-core/opencodelists

Enhancement request: Enable editing of dm+d codelists in the builder after they've been converted from BNF

Open
#3,031 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Summary

In investigating problems with codelist hierarchies, I found that none of the dm+d codelists that were converted from Psuedo-BNF were affected by the hierarchy non-round-tripping problem. This was slightly unexpected and revealed that the conversion process was happening in a way that was slightly surprising to me.

convert_bnf_codelist_version_to_dmd in codelists/action.py does this conversion. Broadly speaking, it grabs the name and slug from the source BNF codelist, appends "-dmd" to them, creates a methodology statement with a markdown link to the source codelist, calls the dmd_csv_data_for_download method on the source codelist to get a csv of the converted dmd codes, then creates an old-style new codelist with all of these.

Since the dm+d coding system is now a fully hierarchy-supporting Builder compatible coding system - I think we should consider changing this to create new-style codelists.

What would you like to achieve?

  • Users cannot currently edit converted dm+d codelists in the builder, only convert or upload new versions
  • The BNF to dm+d mapping file runs several months behind the main dm+d feed and so is often missing newer codes
  • Creating a new style dm+d codelist would then allow a user to create a new version of the converted codelist which would open in the builder and thus show the missing codes and let them include them

Who would benefit and how?

Users would be able to better maintain and adapt dm+d codelists initially created by converting them from BNF

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 convert_bnf_codelist_version_to_dmd in codelists/actions.py and the dmd_csv_data_for_download method in codelists/models.py. Trace how the conversion currently creates an old-style codelist, then identify the Builder-compatible creation path and its existing tests. Done means converted dm+d codelists can create editable Builder versions while retaining the source link and converted codes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.